validator method
A function that must return a validation error if the provided
value is invalid and null otherwise.
Implementation
@override
PhoneError? validator(String value) {
if (value.isEmpty == true || value == "") {
return PhoneError.empty;
}
return _phoneRegExp.hasMatch(value) && value.length < 10
? null
: value.isEmpty
? null
: PhoneError.invalid;
}