如何检索此类文档的顶级集合列表?任何有解决方案的人

How to Retrieve a list of top-level collection of Documents of this type? any one with a solution

我需要在数组中显示所有文档 ID 的内容

我在 Flutter 中使用 firebase;

这是我的职能:

   getlist()async{
     var snapshot = await _firestore.collection("posts").get();
    var data = snapshot.docs.map((doc)=> doc.data());
   return data;
     }

I need to able to access top-level collection of this type any one with a solution

尝试使用“.toList()”

感谢大家的帮助support.but这就是我设法解决问题的方法。

CollectionReference _collectionRef = _firestore.collection("posts"); QuerySnapshot querySnapshot = await _collectionRef.get(); final allData = querySnapshot.docs.map((e) => e.data()).toList();