从firebase获取数据以进行颤振
我需要从firebase获得一个特定元素。我不需要流生成器,我只需要一个元素。有人能帮我吗 我有这个:从firebase获取数据以进行颤振,firebase,flutter,google-cloud-firestore,Firebase,Flutter,Google Cloud Firestore,我需要从firebase获得一个特定元素。我不需要流生成器,我只需要一个元素。有人能帮我吗 我有这个: final DocumentReference postRef = Firestore.instance.collection('Usuarios').document(email); Firestore.instance.runTransaction((Transaction tx) async { DocumentSnapshot postSnapshot = await tx.
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"];
});
QuerySnapshot QuerySnapshot=wait Firestore.instance
.collection(“Usuarios”)
。其中(“电子邮件”,isEqualTo:email)
.getDocuments();
var userList=querySnapshot.documents;
列表ds=用户列表;
D.forEach((u){
用户名=u.data[“名称”];
});