Muhammad Zain
Muhammad Zain

Reputation: 86

Does Flutter Firestore Where clause not support "OR ||" operator

StreamBuilder( stream: _firestore .collection('MessageData') .where( 'RecieverId', isEqualTo: RecieverId) .where('SenderId', isEqualTo: _auth.currentUser!.uid) //I Want OR operator here logicaly. How can i do this? .where( 'RecieverId', isEqualTo: _auth.currentUser!.uid) .where('SenderId', isEqualTo: RecieverId) .snapshots(), builder: (context, snapshot) { return ListView( children: snapshot.data!.docs.map((e) { return Text(e['Message']); }).toList(), ); }, )

Please go this link to see firestore image.

Upvotes: 0

Views: 254

Answers (1)

Kantine
Kantine

Reputation: 771

Use in operator. This allow to check up to 10 equalities according to documentation.

See https://firebase.google.com/docs/firestore/query-data/queries#in_and_array-contains-any

Upvotes: 0

Related Questions