isPhoneNumber static method

bool isPhoneNumber(
  1. String s
)

Checks if string is phone number.

Implementation

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