Filter.where constructor

Filter.where(
  1. Object fieldPath,
  2. WhereFilter op,
  3. Object? value
)

Creates and returns a new Filter, which can be applied to Query.where, Filter.or or Filter.and. When applied to a Query it requires that documents must contain the specified field and that its value should satisfy the relation constraint provided.

  • fieldPath: The name of a property value to compare.
  • op A comparison operation in the form of a string. Acceptable operator strings are "<", "<=", "==", "!=", ">=", ">", "array-contains", "in", "not-in", and "array-contains-any".
  • value The value to which to compare the field for inclusion in a query.
final collectionRef = firestore.collection('col');

collectionRef.where(Filter.where('foo', '==', 'bar')).get().then((querySnapshot) {
  querySnapshot.forEach((documentSnapshot) {
    print('Found document at ${documentSnapshot.ref.path}');
  });
});

Implementation

factory Filter.where(
  Object fieldPath,
  WhereFilter op,
  Object? value,
) = _UnaryFilter.fromString;