endBeforeDocument method

Query<T> endBeforeDocument(
  1. DocumentSnapshot<Object?> snapshot
)

Creates and returns a new Query that ends before the set of field values relative to the order of the query. The order of the provided values must match the order of the order by clauses of the query.

  • snapshot: The snapshot of the document the query results should end before.

Implementation

Query<T> endBeforeDocument(DocumentSnapshot<Object?> snapshot) {
  final (endAt, fieldOrders) = _cursorFromValues(
    snapshot: snapshot,
    before: true,
  );

  final options = _queryOptions.copyWith(
    fieldOrders: fieldOrders,
    endAt: endAt,
  );
  return Query<T>._(
    firestore: firestore,
    queryOptions: options,
  );
}