endBefore method

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

Ends the range just before value (and before key among children equal to value). A null value is a real bound. Throws as endAt does.

Implementation

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