startAt method

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

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.

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

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

Implementation

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

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