startAfterDocument method

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

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

Implementation

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

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