Home > Net >  Im trying to store querysnapshot document into a local list but for some reason the its not working
Im trying to store querysnapshot document into a local list but for some reason the its not working

Time:11-04

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']);
  });
  • Related