resolvePhoneValidationIssue function

String resolvePhoneValidationIssue(
  1. PhoneValidationIssue issue
)

Default English messages for phone validation issues.

Implementation

String resolvePhoneValidationIssue(PhoneValidationIssue issue) {
  return switch (issue) {
    PhoneEmptyIssue() => 'Please enter a phone number',
    PhoneInvalidFormatIssue() => 'Please enter a valid phone number',
    PhoneMissingPlusIssue() => 'Phone number must start with +',
    PhoneTooShortIssue(:final minDigits) =>
      'Phone number must contain at least $minDigits digits',
    PhoneTooLongIssue(:final maxDigits) =>
      'Phone number must contain at most $maxDigits digits',
  };
}