Currently I'm using Appwrite (a self hosted db). When I want to read data with this code:
Future result = database.listDocuments(collectionId: "60be22axxxxxx");
result.then((response) {
print(response);
}).catchError((error) {});
... I get the the following Json response:
{"sum":2,"documents":[{"$id":"60bf87c9a9726","$collection":"60be22a7c4a95","$permissions":{"read":["*"],"write":["*"]},"title":"test"},{"$id":"60bf95c0af7af","$collection":"60be22a7c4a95","$permissions":{"read":["*"],"write":["*"]},"title":"tes","desc":"des"}]}
How can I get single fields like the title
from a db document and save that to a string or better, to an object?
try like this,
String data = jsonDecode(response);
Print(["documents"][0]["title"]);
the [0] is the first for 2 you can get the second with [1], or deploy a boucle.