I am trying to get data from the following path in Flutter from cloud Firestore and I have the following structure
- followers/{currentuser}/userFollowers/{user_id}
- users/user_id/user_details
I am trying to get details of all the followers for the current user. Can anyone help?
i was able to get the first part by
DocumentSnapshot snapshot =
await followersRef.document(currentUser.id).get();
I do not know how to loop thru all the id's to fetch their data from users collections. I was trying the following code but no success.
snapshot.data.forEach((key, value) async {
DocumentSnapshot snapshot2 =
await usersRef.document(snapshot.documentID).get();
print('List' + snapshot2.data);
}