endAtDocument method

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

Creates and returns a new Query that ends at the provided 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 at, in order of the query's order by.

Implementation

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

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