natintosh / intl_phone_number_input

MIT License
164 stars 496 forks source link

Phone number on IOS does not work with country code #379

Open amirbahrawy opened 1 year ago

amirbahrawy commented 1 year ago

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

orangeyong commented 1 year ago

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

honzasima commented 1 year ago

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

dependency_overrides: libphonenumber_plugin: 0.2.3

amirbahrawy commented 1 year ago

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 ?

sangmoonhwang commented 1 year ago

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?

chiptech-mitchell commented 1 year ago

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.

osamamohammed98 commented 11 months ago

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