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

General: Package throws PlatformException for every phone number #101

Closed skuhns closed 1 year ago

skuhns commented 1 year ago

Is there an existing issue for this?

Package/Plugin version

1.0.0

Flutter doctor

Flutter doctor ```bash [✓] Flutter (Channel stable, 3.3.10, on macOS 13.3.1 22E772610a darwin-arm, locale en-US) • Flutter version 3.3.10 on channel stable at /Users/skuhns/Dev/Tools/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 135454af32 (5 months ago), 2022-12-15 07:36:55 -0800 • Engine revision 3316dd8728 • Dart version 2.18.6 • DevTools version 2.15.0 [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at /Users/skuhns/Library/Android/sdk • Platform android-33, build-tools 33.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 14.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14E222b • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) [✓] VS Code (version 1.77.3) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.63.20230303 [✓] Connected device (3 available) • Dev 1’s iPhone (mobile) • 00008030-001260420130802E • ios • iOS 16.4.1 20E252 • macOS (desktop) • macos • darwin-arm64 • macOS 13.3.1 22E772610a darwin-arm • Chrome (web) • chrome • web-javascript • Google Chrome 112.0.5615.137 [✓] HTTP Host Availability • All required HTTP hosts are available • No issues found! ```

Minimal code example

Code sample ```dart import 'package:phone_number/phone_number.dart'; Future getPhone() async { var number = '+18723158282'; try { var result = await PhoneNumberUtil().parse(number); return result; } catch (e) { print(e); return null; } } ```

Current Behavior

PlatformException (PlatformException(InvalidNumber, Failed to parse phone number string '+18723158282'., null, null))

is thrown despite the number being valid. This occurs for any 'number' value, regardless of it if is a valid phone number.

Expected Behavior

Valid PhoneNumber object returned.

Steps To Reproduce

  1. With Xcode 14.3 and iOS 16.4.1 attempt to parse a valid phone number.

Aditional information

Issue only occured after updating Xcode and iOS versions to latest.

skuhns commented 1 year ago

duplicate of closed issue

mohsin2596 commented 1 year ago

What the solution to this problem? I do not see a linked closed issue for it @skuhns

skuhns commented 1 year ago

What the solution to this problem? I do not see a linked closed issue for it @skuhns Solution found in comment thread https://github.com/flutter-form-builder-ecosystem/phone_number/issues/100

wstrange commented 1 year ago

I get this same exception on Android for any phone number