phone method

EzValidator<T> phone([
  1. String? message
])

Checks if the value is a phone number message is the message to return if the validation fails

Implementation

EzValidator<T> phone([String? message]) => addValidation((v, [_]) {
      if (v is String) {
        return phoneRegExp.hasMatch(v)
            ? null
            : message ?? EzValidator.globalLocale.phoneNumber(v, label);
      }
      return 'Invalid type for phone validation';
    });