endAt method

Query endAt(
  1. Object? value, {
  2. String? key,
})

Ends the range at value, included (and at key among children equal to value). A null value is a real bound. Throws a StateError when an end bound is already set, and an ArgumentError when key or the type of value is not allowed by the order.

Implementation

Query endAt(Object? value, {String? key}) {
  validateKey('endAt', 'key', key, optional: true);
  final QueryParams params = spec.params.endAt(
    _boundNode('endAt', value),
    key == null ? null : ChildKey(key),
  );
  _validateLimit(params);
  _validateQueryEndpoints(params);
  if (spec.params.hasEnd) {
    throw StateError(
      'endAt: Ending point was already set (by another call to endAt, '
      'endBefore or equalTo).',
    );
  }
  return _with(params);
}