'How to get specific data from firebase with Flutter?
(EDİT)
I am getting error in below code, what I want to do is only get data of followed users, users are in a different collection, shared content is in a different collection, and
I'm getting an error on the 4th line, I hope I explained it correctly, I would appreciate if you could help.
Errors I get:
The getter 'data' isn't defined for the type
'Stream<QuerySnapshot<Map<String, dynamic>>>'.
Try importing the library that defines 'data', correcting the name to
the name of an existing getter, or defining a getter or field named
'data'.
My Code:
stream: FirebaseFirestore.instance.collection('posts').orderBy('datePublish',descending: true).snapshots().map((event) {
List following = [];
var userSnap = FirebaseFirestore.instance.collection("users").snapshots();
if(Provider.of<UserProvider>(context).getUser.following.contains(userSnap.data["uid"])){
following.add(event);
return following;
}
return following;
}),
userSnap.data, data is not defined!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
