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!
您正在使用列表,但数据由json保存请尝试使用此json格式了解更多信息,请点击此处
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.