flutter-form-builder-ecosystem / phone_number

Flutter plugin for parsing, formatting and validating international phone numbers.
https://pub.dev/packages/phone_number
BSD 3-Clause "New" or "Revised" License
81 stars 63 forks source link

PhoneNumberUtil().validate is not validating many country codes #113

Open giridat opened 1 year ago

giridat commented 1 year ago

Is there an existing issue for this?

Package/Plugin version

2.0.1

Platforms

Flutter doctor

Flutter doctor ```bash [√] 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 ```dart 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

cjltgb520 commented 1 year ago

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