isPhoneNumber static method

bool isPhoneNumber(
  1. String text
)

Implementation

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