startAfter method

Query<T> startAfter(
  1. List<Object?> fieldValues
)

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.

  • fieldValues: The field values to start this query after, in order of the query's order by.
final query = firestore.collection('col');

query.orderBy('foo').startAfter(42).get().then((querySnapshot) {
  querySnapshot.forEach((documentSnapshot) {
    print('Found document at ${documentSnapshot.ref.path}');
  });
});

Implementation

Query<T> startAfter(List<Object?> fieldValues) {
  final (startAt, fieldOrders) = _cursorFromValues(
    fieldValues: fieldValues,
    before: false,
  );

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