isPhoneNumber property

bool get isPhoneNumber

Determines whether a given string represents a valid phone number. Phone numbers must be in the format "+phone number" and can contain digits, hyphens, spaces, or parentheses.

Implementation

bool get isPhoneNumber {
  if (length > 16 || length < 9) return false;
  return _hasMatch(this, r'^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$');
}