I want to the doc[uid] results into the _following list to use somewhere else but its not working
'''
List _followingList = [];
FirebaseFirestore.instance
.collection('venues')
.where('followers', arrayContains: user.uid)
.get()
.then((QuerySnapshot querySnapshot) {
querySnapshot.docs.forEach((doc) {
setState(() {
_followingList.add(doc['uid']);
});
});
});
'''
CodePudding user response:
You dont need to use setState
here.
So, use this line without wrapping it in a setState()
querySnapshot.docs.forEach((doc) {
_followingList.add(doc['uid']);
});