isValidPhone static method
Implementation
static String? isValidPhone(String? phoneNo) {
if (phoneNo == null || phoneNo.isEmpty) {
return 'Please enter a valid phone number.';
}
final regExp = RegExp(
r'^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$',
);
if (!regExp.hasMatch(phoneNo)) {
return 'Please enter a valid phone number';
}
return null;
}