validateValue method
Validates the value.
Returns null
if the value is valid, otherwise an error message.
Call validate() instead of this method when using the validator.
Implementation
@override
String? validateValue(String valueCandidate) {
if (stateBlacklist.contains(valueCandidate)) {
return errorText;
}
if (!regex.hasMatch(valueCandidate)) {
return errorText;
}
if (stateWhitelist.isEmpty || stateWhitelist.contains(valueCandidate)) {
return null;
}
return errorText;
}