Reputation: 394
I need to get a specific element from firebase. I do not need a stream builder, I only need one element. Can anyone help me ?
I have this :
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
}
}
Upvotes: 1
Views: 224
Reputation: 120
maybe this can help you
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"];
});
Upvotes: 1