isValidPhoneNumber property

bool get isValidPhoneNumber

Returns true if this string resembles a telephone number.

Matches strings containing digits, optional leading +, and common separators (hyphens, spaces, parentheses). Requires at least 3 characters.

Implementation

bool get isValidPhoneNumber {
  final s = trim();
  final re = RegExp(r'^\+?[0-9\-\s\(\)]{3,}$');
  return re.hasMatch(s);
}