我需要从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
}
}
也许这可以帮助您
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"];
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句