颤振:我如何从列表中的火库获取数据<String>?



嗨,我正在尝试从firestore数据库中获取List<String>的数据,因为我创建了变量List<String> listCour;,并且我使用该指令从Firestore获取数据

   Firestore.instance
    .collection('MATH')
    .document(doc.documentID)
    .collection("cours")
    .snapshots()
    .listen(
    (cour)=> cour.documents.forEach((doc){
           listCour.add(doc.documentID);                   
             })
          );

但列表没有数据!

尝试使用doc.data

listCour.add(doc.data);                   
Firestore.instance
    .collection('MATH')
    .document(doc.documentID)
    .collection("cours")
    .getDocuments()
    .then((QuerySnapshot snapshot) {
      snapshot.documents...
    })

最新更新