idPhoneNumber static method
Implementation
static bool idPhoneNumber(String number, {bool isFixedPhone = false}) {
if (number.isEmpty) {
return true;
}
final RegExp phoneNumberRegExp = RegExp(
r'^(^\+62|62|^08)(\d{3,4}-?){2}\d{3,4}$',
);
final RegExp phoneFixedNumberRegExp = RegExp(
r'^(^\+62|62|^0)(\d{3,4}-?){2}\d{3,4}$',
);
if (isFixedPhone) {
return phoneFixedNumberRegExp.hasMatch(number);
}
return phoneNumberRegExp.hasMatch(number);
}