where method
Get a list of documents matching all clauses
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
Future<List<T>> where(
List<Clause> clauses, {
List<OrderBy>? orderBy,
int? limit,
}) async {
final query = _getWhereWithOrderByAndLimitQuery(
clauses: clauses,
orderBy: orderBy,
limit: limit,
);
final snapshot = await query.get();
return snapshot.docs.toListT();
}