intl_phone_number_input icon indicating copy to clipboard operation
intl_phone_number_input copied to clipboard

Phone number on IOS does not work with country code

Open amirbahrawy opened this issue 1 year ago • 6 comments

Describe the bug On getRegionInfoFromPhoneNumber has flutter: PlatformException(1, The country code is invalid., null, null) on iOS. On Android works fine

Package version last version

Flutter version 3.0.5

amirbahrawy avatar Mar 14 '23 09:03 amirbahrawy

I face this issue too, happen when the input comes without country code, no issue before this.

And I have made a few assumption on the input, and found out the bug below from flutter's getRegionInfoFromPhoneNumber(phoneNumber, isoCode)

  1. if i set the isoCode to "MY" => return positive result 1.1 but when I call for result.dialCode => I get "MY" 1.2 tried to insert "" as empty string for countryCode => exception 1.3 tried to insert phoneNumber without +60 (the country code) => exception

Printing the parsed phone number props property returns [+6011xxxxxxxx, MY, MY]

My guess is that the new PhoneNumberKit is validating wrong input field, and thus returning wrong

orangeyong avatar Mar 18 '23 08:03 orangeyong

for fix use older dependency, problem is not in this package:

dependency_overrides: libphonenumber_plugin: 0.2.3

honzasima avatar Mar 23 '23 08:03 honzasima

for fix use older dependency, problem is not in this package:

dependency_overrides: libphonenumber_plugin: 0.2.3

it worked well but is there another solution or this the only thing i can do ?

amirbahrawy avatar Apr 02 '23 08:04 amirbahrawy

For fix use older version dependency

dependency_overrides: libphonenumber_plugin: 0.2.3

This does not sounds like a long-term fix since we would be stuck with the old dependency and its transitive dependencies. Is there a better way to solve this issue or should we just wait for the next libphonenumber_plugin version?

sangmoonhwang avatar Apr 30 '23 05:04 sangmoonhwang

I used the last version of intl_phone_number_input (0.7.3+1) and overrode the libphonenumber_plugin to the latest (0.3.1) and the seems to be the best fix until the PR https://github.com/natintosh/intl_phone_number_input/pull/375 is merged and new version is released.

chiptech-mitchell avatar May 17 '23 00:05 chiptech-mitchell

for fix use older dependency, problem is not in this package:

dependency_overrides: libphonenumber_plugin: 0.2.3

thanks for your help it's work with me

osamamohammed98 avatar Sep 25 '23 12:09 osamamohammed98