startAtDocument method

Query<T> startAtDocument(
  1. DocumentSnapshot<Object?> documentSnapshot
)

Creates and returns a new Query that starts 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.

  • documentSnapshot The snapshot of the document the query results should start at, in order of the query's order by.

Implementation

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

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