copyWithField<T> method

StringOperators copyWithField<T>(
  1. Field<StringOperators, T> field,
  2. T value
)

Returns a copy of this entity with field set to value.

Delegates to copyWith: the receiver is never mutated and a null value keeps the current field value.

Implementation

StringOperators copyWithField<T>(Field<StringOperators, T> field, T value) {
  switch (field.name) {
    case 'contains':
      return copyWith(contains: value as String?);
    case 'eq':
      return copyWith(eq: value as String?);
    case 'in_':
      return copyWith(in_: value as List<String>?);
    case 'isNull':
      return copyWith(isNull: value as bool?);
    case 'notContains':
      return copyWith(notContains: value as String?);
    case 'notEq':
      return copyWith(notEq: value as String?);
    case 'notIn':
      return copyWith(notIn: value as List<String>?);
    case 'regex':
      return copyWith(regex: value as String?);
    default:
      throw ArgumentError.value(
        field.name,
        'field',
        'StringOperators has no settable field with this name',
      );
  }
}