Filter.or constructor

Filter.or(
  1. List<Filter> filters
)

Creates and returns a new Filter that is a disjunction of the given Filters. A disjunction filter includes a document if it satisfies any of the given Filters.

The returned Filter can be applied to Query.where Filter.or, or Filter.and. When applied to a Query it requires that documents must satisfy one of the provided Filters.

  • filters The Filters for OR operation. These must be created with calls to Filter,
final collectionRef = firestore.collection('col');

// doc.foo == 'bar' || doc.baz > 0
final orFilter = Filter.or(Filter.where('foo', WhereFilter.equal, 'bar'), Filter.where('baz', WhereFilter.greaterThan, 0));

collectionRef.where(orFilter).get().then((querySnapshot) {
  querySnapshot.forEach((documentSnapshot) {
    print('Found document at ${documentSnapshot.ref.path}');
  });
});

Implementation

factory Filter.or(List<Filter> filters) = _CompositeFilter.or;