where method

RealtimeQueryBuilder<T> where(
  1. String field, {
  2. Object? isEqualTo,
  3. Object? isNotEqualTo,
  4. Object? isGreaterThan,
  5. Object? isGreaterOrEqualTo,
  6. Object? isLowerThan,
  7. Object? isLowerOrEqualTo,
  8. Object? arrayContains,
  9. Iterable? isIn,
  10. Object? matches,
})

Adds a where clause to the query with the specified field and condition. The condition can be one of the following operators:

  • isEqualTo: Matches documents where the field is equal to the specified value.
  • isNotEqualTo: Matches documents where the field is not equal to the specified value.
  • isGreaterThan: Matches documents where the field is greater than the specified value.
  • isGreaterOrEqualTo: Matches documents where the field is greater than or equal to the specified value.
  • isLowerThan: Matches documents where the field is less than the specified value.
  • isLowerOrEqualTo: Matches documents where the field is less than or equal to the specified value.
  • arrayContains: Matches documents where the field is an array that contains the specified value.
  • isIn: Matches documents where the field's value is in the specified list of values.
  • matches: Matches documents where the field matches the specified pattern. The pattern can be a string (for simple substring matching) or a regular expression (for more complex pattern matching).

Implementation

RealtimeQueryBuilder<T> where(
  String field, {
  Object? isEqualTo,
  Object? isNotEqualTo,
  Object? isGreaterThan,
  Object? isGreaterOrEqualTo,
  Object? isLowerThan,
  Object? isLowerOrEqualTo,
  Object? arrayContains,
  Iterable? isIn,
  Object? matches,
}) {
  return _copyWith(
    ast: _ast.addAnd(
      _buildQueryClause(
        field,
        isEqualTo: isEqualTo,
        isNotEqualTo: isNotEqualTo,
        isGreaterThan: isGreaterThan,
        isGreaterOrEqualTo: isGreaterOrEqualTo,
        isLowerThan: isLowerThan,
        isLowerOrEqualTo: isLowerOrEqualTo,
        arrayContains: arrayContains,
        isIn: isIn,
        matches: matches,
      ),
    ),
  );
}