phone_number icon indicating copy to clipboard operation
phone_number copied to clipboard

PhoneNumberUtil().validate is not validating many country codes

Open giridat opened this issue 1 year ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Package/Plugin version

2.0.1

Platforms

  • [X] Android
  • [ ] iOS
  • [ ] Linux
  • [ ] MacOS
  • [ ] Web
  • [ ] Windows

Flutter doctor

Flutter doctor
[√] Flutter (Channel stable, 3.10.6, on Microsoft Windows [Version 10.0.19045.3324], locale en-IN)
    • Flutter version 3.10.6 on channel stable at C:\src\flutter\flutter                          
    • Upstream repository https://github.com/flutter/flutter.git                                  
    • Framework revision f468f3366c (5 weeks ago), 2023-07-12 15:19:05 -0700                      
    • Engine revision cdbeda788a                                                                  
    • Dart version 3.0.6                                                                          
    • DevTools version 2.23.1                                                                     
                                                                                                  
[√] Windows Version (Installed version of Windows is version 10 or higher)                        

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\Legion\AppData\Local\Android\Sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = C:\Users\Legion\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)
    • Windows (desktop) • windows                                         
    • windows-x64   • Microsoft Windows [Version 10.0.19045.3324]

[√] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.


Minimal code example

Code sample
 String phone =
          "+3588376877308"; // this cc is not working if I replace it with +91 it will work 
      debugPrint(phone);

      if ((await PhoneNumberUtil()
          .validate(phone, regionCode: selectedCountry.countryCode))) {
             debugPrint("validated");
      } else {
                   debugPrint("couldn't validate");
      }
    }

Current Behavior

Unable to validate many country codes

Expected Behavior

The codes provided should validate.

Steps To Reproduce

  1. Copy the code example above.
  2. run the code with the selected country code
  3. Observe that the particular country code doesn't validate.

Aditional information

I have already been using the main branch as advised in other issues.

phone_number: git: url: https://github.com/flutter-form-builder-ecosystem/phone_number.git ref: main

Screenshot 2023-08-18 115041

giridat avatar Aug 18 '23 06:08 giridat

+5716434737, This number was judged to be invalid, but it was valid after I changed libphonenumber to 8.12.32

cjltgb520 avatar Sep 11 '23 05:09 cjltgb520