【问题标题】:Get data from firebase to flutter从 firebase 获取数据以进行颤振
【发布时间】:2018-09-04 00:37:58
【问题描述】:

我需要从 firebase 获取特定元素。我不需要流生成器,我只需要一个元素。谁能帮我 ?

我有这个:

final DocumentReference postRef = Firestore.instance.collection('Usuarios').document(email);

Firestore.instance.runTransaction((Transaction tx) async {
    DocumentSnapshot postSnapshot = await tx.get(postRef);
    if(postSnapshot.exists)
    {
        // do something
    }
}

【问题讨论】:

    标签: firebase flutter google-cloud-firestore


    【解决方案1】:

    也许这对你有帮助

        QuerySnapshot querySnapshot = await Firestore.instance
                        .collection('Usuarios')
                        .where("email", isEqualTo: email)
                        .getDocuments();
    
         var userList = querySnapshot.documents; 
         List<DocumentSnapshot> ds = userList;
    
         ds.forEach((u) {
           userName = u.data["name"];
         });
    

    【讨论】:

      猜你喜欢
      • 2022-10-06
      • 2021-02-16
      • 2021-12-22
      • 1970-01-01
      • 2019-12-31
      • 2019-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多