copyWith method
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,
);
}