Reputation: 33
database viewI have tried to assign the field value to a local variable but its not working
getData() async {
String userId = 'userId';
Firestore.instance.collection('user').document(userId).snapshots();
var snapshot;
var userDocument = snapshot.data;
String _myAddress = userDocument["address"];
return Firestore.instance
.collection('letters')
.where("source Box", isEqualTo: _myAddress)
.snapshots();
}
Upvotes: 1
Views: 224
Reputation: 3393
You should make your question more clear but I have tried fixing some obvious problems with your code.
getData() async {
String userId = 'userId';
var userDocument = await Firestore.instance.collection('user').document(userId).get();
String _myAddress = userDocument["address"];
return Firestore.instance
.collection('letters')
.where("source Box", isEqualTo: _myAddress)
.snapshots();
}
Upvotes: 1