I am new to flutter and looking for some sort of multiple where clauses or logical AND operator in my query, tried several things but none working for me. I am filtering users whose IDs match currently logged in user ID. Secondly there is a bool field status in firestore, I want to filter "status"==false as well. i.e
where userid=="currently logged in userid" && status==false
Stream<QuerySnapshot> getData() async*{
FirebaseUser firebaseUser = await FirebaseAuth.instance.currentUser();
yield* Firestore.instance.collection('order').where("userid", isEqualTo: firebaseUser.email.toString()).snapshots();
}
Secondly, I want to update this approve = false to approve = true on button press how can I do that? My IDE is showing a red line below that.
onPressed: () async {
await db.collection('booking_tbl').document(doc.documentID).updateData('approve':true);
},
Full piece of code is here:
StreamBuilder<QuerySnapshot>(
stream: db.collection('booking_tbl').snapshots(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return Column(
children: snapshot.data.documents.map((doc) {
return ListTile(
title: Text("Press the button to confirm booking"),
trailing: IconButton(
icon: Icon(Icons.verified_user),
color: Colors.green,
onPressed: () async {
await db.collection('booking_tbl').document(doc.documentID).updateData('approve':true);
},
),
),
}).toList(),
);
} else {
return SizedBox();
}
}),