Open shabanaqureshi opened 1 year ago
I also had the same problem so I just extracted the last 10 digits of the string that I got from the autofil hint. Below is the code for the same.
phoneController.text = extractLast10Digits(phone);
String extractLast10Digits(String input) {
String digitsOnly = input.replaceAll(RegExp(r'[^0-9]'), '');
if (digitsOnly.length >= 10) {
return digitsOnly.substring(digitsOnly.length - 10);
} else {
return digitsOnly;
}
}
Hello, I am using the following library to extract the phone number of the user. I want to enable auto filling of mobile number, I am using the PhoneFieldHint library, am able to get the phone number with the country code, but i want to get only the phone number. Question: How do i get only the phone number and not the country code or how can i extracct the phone number from this response?