flutter-libphonenumber icon indicating copy to clipboard operation
flutter-libphonenumber copied to clipboard

RegionInfo Formatted result unexpected

Open willylaurents opened this issue 3 years ago • 0 comments

im have a code for autoformat like this:

Future<String> getFormattedPhoneNumber(String phoneNumber) async {
    final RegionInfo regionInfo = await PhoneNumberUtil.getRegionInfo(phoneNumber: phoneNumber, isoCode: 'id');
    return regionInfo.formattedPhoneNumber ?? phoneNumber;
}

when the phoneNumber is 0877123 the regionInfo result is [RegionInfo prefix=62, iso=ID, formatted=0877123] when the phoneNumber is 08771234 the regionInfo result is [RegionInfo prefix=62, iso=ID, formatted=8771234]

in formatted property the 0 is missing.

willylaurents avatar Jun 15 '22 02:06 willylaurents