Reputation: 5778
I want to get the documents of a few users (in my collection: users). I stored all the ID's that I want in a list.
List shortIDList = [12345, 23425, 32453]
I'm trying this function to get the users from the shortIDList.
shortIDList.forEach((element) => getFirestoreUsers(st: element));
getFirestoreUsers({String st}) async {
await Firestore.instance
.collection('users')
.document('$st')
.get()
.then((DocumentSnapshot ds) {
print(ds.data);
// I would like to add all these documents to a futurebuilder
});
}
I would like to add all the documents (to a new list?) That I can use in a futurebuilder, to display all the user information example: profile picture, name etc...
Is that possible?
Thanks!
Upvotes: 0
Views: 1136
Reputation: 5778
I've found the solution:
You can add it to a list.
myList.add(ds.data);
But you have to define the list:
List<Map<String, dynamic>> myList = List<Map<String, dynamic>>();
Then it's possible to use it in a futureBuilder
Upvotes: 0
Reputation: 1272
you are using a list but data is saved by json try using this json format for more see this link click here
Upvotes: 1