📌  相关文章
📜  获取集合中的所有文档 firestore flutter - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:25.038000             🧑  作者: Mango

代码示例1
final _fireStore = FirebaseFirestore.instance;
Future getData() async {
    // Get docs from collection reference
    QuerySnapshot querySnapshot = await _fireStore.collection('collectionName').get();;

    // Get data from docs and convert map to List
    final allData = querySnapshot.docs.map((doc) => doc.data()).toList();
  //for a specific field
  final allData =
          querySnapshot.docs.map((doc) => doc.get('fieldName')).toList();

    print(allData);
}