copyWith method

TextValidationConfig copyWith({
  1. Object? minLength = _unset,
  2. Object? maxLength = _unset,
  3. bool? allowEmpty,
  4. bool? allowOnlyWhitespace,
  5. bool? trimWhitespace,
  6. Object? pattern = _unset,
  7. Set<String>? blacklistedWords,
  8. Object? allowedCharacters = _unset,
  9. bool? wholeWordBlacklist,
})

Returns a copy of this config with the given fields replaced.

Nullable fields (minLength, maxLength, pattern, allowedCharacters) can be cleared by passing null explicitly; omitting a parameter keeps the current value.

Implementation

TextValidationConfig copyWith({
  Object? minLength = _unset,
  Object? maxLength = _unset,
  bool? allowEmpty,
  bool? allowOnlyWhitespace,
  bool? trimWhitespace,
  Object? pattern = _unset,
  Set<String>? blacklistedWords,
  Object? allowedCharacters = _unset,
  bool? wholeWordBlacklist,
}) {
  return TextValidationConfig(
    minLength:
        identical(minLength, _unset) ? this.minLength : minLength as int?,
    maxLength:
        identical(maxLength, _unset) ? this.maxLength : maxLength as int?,
    allowEmpty: allowEmpty ?? this.allowEmpty,
    allowOnlyWhitespace: allowOnlyWhitespace ?? this.allowOnlyWhitespace,
    trimWhitespace: trimWhitespace ?? this.trimWhitespace,
    pattern: identical(pattern, _unset) ? this.pattern : pattern as String?,
    blacklistedWords: blacklistedWords ?? this.blacklistedWords,
    allowedCharacters:
        identical(allowedCharacters, _unset)
            ? this.allowedCharacters
            : allowedCharacters as String?,
    wholeWordBlacklist: wholeWordBlacklist ?? this.wholeWordBlacklist,
  );
}