setWithRegex method
Sets given value
only if regex
matches.
regex
- override of StringControl.regex -> one of them can't be 'null'.
Regex is typically used with StringControl.withRegex constructor and then setting value via setValue or value
setter.
Implementation
void setWithRegex(String? value,
{String? regex, bool notify = true, bool forceNotify = false}) {
assert(regex != null || this.regex != null);
regex ??= this.regex;
if (RegExp(regex!).hasMatch(value ?? '')) {
super.setValue(value, notify: notify, forceNotify: forceNotify);
} else {
printDebug('value [$value] has not match regex [$regex]');
}
}