扑动如何从Firebase获得所有子集合?我需要所有的文件和所有的收藏品 未来类型产品(字符串currentUser)异步{ 等待databaseReference.collection('products').getDocuments()。然后((QuerySnapshot快照){ _type=snapShot.documents; _type.forEach((数据){ 打印(data.documentID);在此处输入图像描述 }); }); }

扑动如何从Firebase获得所有子集合?我需要所有的文件和所有的收藏品 未来类型产品(字符串currentUser)异步{ 等待databaseReference.collection('products').getDocuments()。然后((QuerySnapshot快照){ _type=snapShot.documents; _type.forEach((数据){ 打印(data.documentID);在此处输入图像描述 }); }); },firebase,flutter,collections,google-cloud-firestore,document,Firebase,Flutter,Collections,Google Cloud Firestore,Document,在提问之前,请确保在StackOverflow上正确搜索。很可能您的问题已经有了答案,因为情况似乎是这样的:没有打印任何数据是的,因为您的产品集合中没有文档,您已经创建了子集合请尝试此产品ref.getDocuments().subcollectionname().getDocuments().Then抱歉的产品ref.subcollectionname().getDocuments().谢谢你,一切顺利 Future<void> typeProduct (String curr

在提问之前,请确保在StackOverflow上正确搜索。很可能您的问题已经有了答案,因为情况似乎是这样的:没有打印任何数据是的,因为您的产品集合中没有文档,您已经创建了子集合请尝试此产品ref.getDocuments().subcollectionname().getDocuments().Then抱歉的产品ref.subcollectionname().getDocuments().谢谢你,一切顺利
 Future<void>  typeProduct (String currentUser) async {
    await databaseReference.collection('products').getDocuments().then((QuerySnapshot snapShot){
      _type=snapShot.documents;
      _type.forEach((data){
        print(data.documentID);enter image description here
      });
    });
  }
final productsRef = Firestore.instance.collection(products);    
productsRef.getDocuments().then(( QuerySnapshot snapshot){
            snapshot.documents.forEach((DocumentSnapshot doc){
                print(doc.data);
            });
        });