我有2个收藏集。我可以从第一个集合中获取ID列表,但无法使用这些ID从第二个集合中检索具有这些ID的文档
Stream<QuerySnapshot> getSharedGroupsStreamSnapshot(
BuildContext context) async* {
final uid = await Provider.of(context).auth.getCurrentUID();
yield* await FirebaseFirestore.instance
.collection("sharedLists")
.where('userID', isEqualTo: uid)
.get()
.then((value) {
FirebaseFirestore.instance
.collection("sharedLists")
.where("accepted", isEqualTo: true)
.get()
.then((event) {
event.docs.forEach((element) {
gid.add(element['groupId']);
FirebaseFirestore.instance
.collection('groups')
.where(FieldPath.documentId, whereIn: gid)
.get()
.then((snapshot) => {
grp = snapshot.docs
.map((document) => document.data())
.toList()
});
print(grp);
});
//getStream(context);
});
});
}