streamWhere method

  1. @override
Stream<List<T>> streamWhere(
  1. List<Clause> clauses, {
  2. List<OrderBy>? orderBy,
  3. int? limit,
})
override

Get a list of documents matching all clauses

Refreshes automatically when new matching data is added/removed from the collection

orderBy: optionally provide a list of OrderBy to order the results

!Important!

OrderBy criteria will be created, moved, or removed depending on what where Clauses are given.

If you provide OrderBy criteria matching a Clauses field where

  • any clause is a range operator and the first orderBy's field doesn't match the first where clause's field, the orderBy criteria will be moved if it exists or created if it doesn't exist
  • any clause is an equality or in (contains) operator, the orderBy criteria will be removed

Rules

  • If you include a filter with a range comparison, your first ordering must be on the same field
  • You cannot order your query by any field included in an equality or in clause

limit: optionally provide a maximum value of items to be returned

throws a MissingValueException when no Clauses are given throws a MoreThanOneFieldInRangeClauseException when range filters are on different fields

Implementation

@override
Stream<List<T>> streamWhere(
  List<Clause> clauses, {
  List<OrderBy>? orderBy,
  int? limit,
}) {
  final query = _getWhereWithOrderByAndLimitQuery(
    clauses: clauses,
    orderBy: orderBy,
    limit: limit,
  );

  return query.snapshots().toListT();
}