phoneValidator static method
Implementation
static bool phoneValidator(String phone) {
//credit card if u wanna
if (phone != "" && phone.contains(r"^(?:[+0][1-9])?[0-9]{10,12}$")) {
// ^ beginning of a string
// (?:[+0][1-9])? optionally match a + or 0 followed by a digit from 1 to 9
// [0-9]{10,12} match 10 to 12 digits
// $ end of the string
return true;
}
return false;
}