valid static method
Implementation
static PhoneNumberInputValidator valid({
/// custom error message
String? errorText,
/// determine whether a missing value should be reported as invalid
bool allowEmpty = true,
}) {
return (PhoneNumber? valueCandidate) {
if (valueCandidate == null && !allowEmpty) {
return errorText ?? 'invalidPhoneNumber';
}
if (valueCandidate != null && (!allowEmpty || valueCandidate.nsn.isNotEmpty) && !valueCandidate.isValid()) {
return errorText ?? 'invalidPhoneNumber';
}
return null;
};
}