valid static method

PhoneNumberInputValidator valid(
  1. BuildContext context, {
  2. String? errorText,
})

Implementation

static PhoneNumberInputValidator valid(
  BuildContext context, {
  /// custom error message
  String? errorText,
}) {
  return (PhoneNumber? valueCandidate) {
    if (valueCandidate != null &&
        valueCandidate.nsn.isNotEmpty &&
        !valueCandidate.isValid()) {
      return errorText ??
          PhoneFieldLocalization.of(context).invalidPhoneNumber;
    }
    return null;
  };
}