I have a list of a document ids and I want to fetch the data of those documents from Firestore and display it using the FutureBuilder.
contestList = [awebnmsdfjkeeer23,324cdas4asdf, 34sdfasgadsg]
Future<void> fetchUsergameData() async {
contestList.forEach((element) async{
await Firestore.instance.collection('LiveGames').document('$element')
.get().then((dss) {
if(dss.exists) {
tempgame.add(dss.data["GameData"]);
temproom.add(dss.data["Room"]);
temptitle.add(dss.data["Title"]);
temp = tempgame + temproom + temptitle;
joinedContests.add(temp);
}
}).then((value) => {});
});
print(joinedContests);
}
}
I have used the above function to get the data and try to store in the list, like one document data in list. But i am getting the blank list of the data. How to get the whole document and display it using the FutureBuilder in flutter
'$element'
justelement
. Maybe that's why you are not getting the document (wrong/uninteded id). – VLXU