equalTo method

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

Keeps only the children equal to value (and with key key when given): a start and an end bound at once, so it throws when either is already set.

Implementation

Query equalTo(Object? value, {String? key}) {
  validateKey('equalTo', 'key', key, optional: true);
  validateFirebaseDataArg('equalTo', value, spec.path);
  if (spec.params.hasStart) {
    throw StateError(
      'equalTo: Starting point was already set (by another call to '
      'startAt/startAfter or equalTo).',
    );
  }
  if (spec.params.hasEnd) {
    throw StateError(
      'equalTo: Ending point was already set (by another call to '
      'endAt/endBefore or equalTo).',
    );
  }
  return startAt(value, key: key).endAt(value, key: key);
}