我正在尝试获取properties
文档及其集合,它是子集合,我如何流式传输它的数据,这是我编写的函数,但它需要 2 个地图才能到达Category List
并且没有输出。也许它可以通过拖流或其他逻辑来解决,我将使用这个流Stream builder
。提前致谢
final CollectionReference _catogiresCollection =
FirebaseFirestore.instance.collection('categories');
Stream<Iterable<Stream<List<Category>>>> get docData{
return _catogiresCollection.snapshots().map((snapshot1) {
return snapshot1.docs.map((doc1) {
return doc1.reference.collection("properties").snapshots().map((snapshot2) {
return snapshot2.docs.map((doc2) {
return Category.fromSnapShot(doc2);
}).toList();
});
});
});
}