Coder Social home page Coder Social logo

flutter-form-builder-ecosystem / phone_number Goto Github PK

View Code? Open in Web Editor NEW
81.0 81.0 64.0 301 KB

Flutter plugin for parsing, formatting and validating international phone numbers.

Home Page: https://pub.dev/packages/phone_number

License: BSD 3-Clause "New" or "Revised" License

Objective-C 1.12% Swift 11.76% Ruby 3.84% Dart 70.05% Java 13.24%
dart flutter flutter-plugin libphonenumber phone-number phonenumberkit

phone_number's People

Contributors

clouddevil avatar deandreamatias avatar dertuca avatar iamsahilsonawane avatar kyeshmz avatar maqoo avatar nashfive avatar nepali-programmer avatar nicbn avatar oluwaseye avatar onatcipli avatar patuoynageek avatar thedalelakes avatar thienvu18 avatar via-guy avatar victoruvarov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

phone_number's Issues

RegEx (RegExp) for valid phone number

Environment

Package version: 1.0.0

Description

What you'd like to happen:

Provide a RegExp of valid phone numbers.

RegExp is widely used to find a specific pattern in a text (string). To find for the phone number that a text contains, it'd be good to have the RegExp provided.

Example
"Hey yo my phone number is +1 123 234 3456" --> "+1 123 234 3456"
"Call me maybe 😉 123-2222-3333" --> "123-2222-3333"

RegEx for phone numbers that I found on the Internet: ^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3,4}[-\s\.]?[0-9]{4,6}$
I'm not sure if this would work well for every phone number formats of every country though.

My ultimate goal
Ultimately, I just want a way to easily find the phone number that a text (string) contains. RegExp may not be the only solution for this, so if there's a better way to do this than using RegExp, please tell me

deprecated API

/phone_number-0.8.1/android/src/main/java/com/julienvignali/phone_number/PhoneNumberPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

Different parse results with the same number

phone_number: ^1.0.0

When parsing a number with no regionCode, for example 01114377479 (An Egyptian number), sometimes it returns +201114377479, other times it fails to parse. Why would there be this inconsistency, how can i help?

countryCode returning dial code instead of ISO 1366 country code

Environment

Package version: 0.12.0+2 (latest on pub.dev as of July 2022)

Flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.1, on Arch Linux 5.18.7-arch1-1, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2021.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.3)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

• No issues found!
Code sample
// random US number
final hint = "+11234567890"

// parse number into PhoneNumber object
final phoneNumber = await PhoneNumberUtil().parse(hint);

// extract country code
print(phoneNumber.countryCode) // prints 1 instead of 'US' as documentation states

Description

Either documentation is incorrect or function is incorrect. Documentation states countryCode should return ISO 3166-1 alpha-2 codes like 'US', instead it returns the country's dialcode.

Documentation states

Expected behavior:
phoneNumber.countryCode should return country code i.e. "US" or "ZA"

Current behavior:
phoneNumber.countryCode returns country's dialing code i.e. "1" or "27"

Tested on US number and South African numbers.

format() should allow the region to be empty

Environment

Package version: v1.0.0

Description

What you'd like to happen:

We use E164 phone numbers (+12125004000, +442075972524) in our app. As these clearly indicate the country, the extra step of parsing the first few characters in order to tell format() what country we are in seems like extra effort. In addition, in v1.0.0 it seems like region is ignored when the phone number is passed in E164 format.

The new parse() method has been great so far! I'd love to see format() follow the same path of making region optional, with its use enhancing the method when necessary or useful.

Alternatives you've considered:

We are using this library and format() with regionCode:"US" as a placeholder for now, and it works, but are concerned that a future enhancement, change, or bug fix might cause this faked functionality to behave in a different manner.

I tried a different library, but it was feature incomplete, as it had only implemented mobile and fixedLine, and not Toll Free, etc and so the validation in that library failed to meet our needs.

PR #73 causing failure in validate() on IOS

Description

Pull Request #73 which fixes Issue #64 on Android breaks IOS.

Expected behavior: validate() works on IOS when not specifying a regionCode to the dart lib, region to the IOS lib

Current behavior: validate() fails on IOS because it is checking to see if region is empty and throwing an exception if it is. Which it now can be in the dart lib.

Steps to reproduce

  1. Install the library main @ 688e851
  2. Run validate() on IOS
  3. See PlatformException thrown that 'string is empty' but it is really the region that is empty

private func validate(_ call: FlutterMethodCall, result: FlutterResult){
guard
let arguments = call.arguments as? [String : Any],
let number = arguments["string"] as? String,
let region = arguments["region"] as? String
else {
result(FlutterError(code: "InvalidArgument",
message: "The 'string' argument is missing.",
details: nil))
return
}
let isValid = kit.isValidPhoneNumber(number,withRegion: region);
let res:[String: Bool] = [
"isValid": isValid
]
result(res)
}

The guard section needs to allow region to be empty, and then withRegion needs to be optionally passed to kit.isValidPhoneNumber()

Stacktrace/Logcat

PlatformException(InvalidArgument, The 'string' argument is missing., null, null)

International format returned although region code is defined

For this: await PhoneNumberUtil().parse("+17703228", regionCode: "US");

it returns (268) 770-2832 for .international and 2687702832 for national. Which doesn't respond to a US number. I would expect regionCode to make the parse return invalid/null until a valid US number is provided.

Note that I'm running this on text change so it is certainly not a whole number while the user types, but since there is a specific regionCode it shouldn't need to parse the number for other countries

validation is done with future

please provide validation without future
if plugin need to load any data make init function to be called at start of app and then validation and other actions done without Fututre async wait

`phone_number` does not specify a Swift version

running under ios platform, phone_number plugin build errors as below:

Unable to determine Swift version for the following pods:
- phone_number does not specify a Swift version and none of the targets (Runner) integrating it have the SWIFT_VERSION attribute set. Please contact the author or set the SWIFT_VERSION attribute in at least one of the targets that integrate this pod.
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/target_validator.rb:125:in verify_swift_pods_swift_version' /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/installer/xcode/target_validator.rb:39:in validate!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:590:in validate_targets' /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/installer.rb:158:in install!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/command/install.rb:52:in run' /Library/Ruby/Gems/2.3.0/gems/claide-1.0.3/lib/claide/command.rb:334:in run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:52:in run' /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/bin/pod:55:in <top (required)>'
/usr/local/bin/pod:22:in load' /usr/local/bin/pod:22:in

'

Invalid number with valid format in IOS

When trying to check phone number validation it returns invalid even in a valid format. It's having on IOS devices only and not on all IOS devices. I saw that the native package you are using is updated recently but you haven't updated the package version in your package. Hopefully, you will solve the issue as soon as possible.

Is PhoneNumberUtil().parse regionCode required?

final result = await PhoneNumberUtil().parse('+12223334444');

seems to throw throw this error after upgrading from version 0.6.2+3 to 0.8.0

noSuchMethodError: Class 'PhoneNumber' has no instance method '[]'.

v1.0.0 working on Simulator IOS 15.5, not working on real iPhone on 15.6

I've been testing v1.0.0 on Android and IOS. Android is working on devices and simulator, and it works fine in the Apple Simulator using the iPhone SE and IOS 15.5, but the same code on an iPhone running IOS 15.6 fails to correctly validate numbers.

I'm not sure if the interface to PhoneKit changed between 15.5 and 15.6. I'm working on installing XCode 14 Beta so I can create an IOS 15.6 device in the simulator to test further and provide more details. I tested on a simulator 15.5 iPhone SE with XCode 13.4.1 and that works fine.

I'd be surprised if the issue was 15.5 vs 15.6, since the SDK for 15.5 pretty much says it supports 15.6.

It could also be a flutter or dart issue, I'm not yet sure. Just wanted to start documenting my experience.

Environment

Package version: v1.0.0

Flutter doctor
[✓] Flutter (Channel stable, 3.0.5, on macOS 12.5 21G72 darwin-x64, locale en-US)
    • Flutter version 3.0.5 at /Users/beckman/dev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f1875d570e (5 weeks ago), 2022-07-13 11:24:16 -0700
    • Engine revision e85ea0e79c
    • Dart version 2.17.6
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc1)
    • Android SDK at /Users/beckman/Library/Android/sdk
    • Platform android-31, build-tools 33.0.0-rc1
    • ANDROID_HOME = /Users/beckman/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • 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.12+0-b1504.28-7817840)

[✓] VS Code (version 1.70.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.46.0

[✓] Connected device (3 available)
    • Pixel 2 (mobile) • HT78P1A00981 • android-arm64  • Android 11 (API 30)
    • macOS (desktop)  • macos        • darwin-x64     • macOS 12.5 21G72 darwin-x64
    • Chrome (web)     • chrome       • web-javascript • Google Chrome 104.0.5112.79

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
Code sample
String numClean = '+1 203 322-2252';
try {
      bool numIsValid = await PhoneNumberUtil().validate(numClean, regionCode: 'US');
} catch (e) {
      if (!(e is PlatformException) || e.code != 'InvalidNumber') {
        print("Got Error _getRegionInfo validate onError: ${e.toString()}");
      }
}

Description

Expected behavior: Return true

Current behavior: Returns false

Steps to reproduce

  1. Deploy app on IOS Device running 15.6
  2. Run app
  3. Enter phone numbers or just run the above phone number

Images

Stacktrace/Logcat

Null safety support

Hello :)

In order to migrate to flutter v2, we need this package to support null safety :) :D

Anything planed ?

onInputChanged usage

Hi there,
I've noticed that onInputChanged is called when setting initialValue and also when focusing out from the textfield.
Any way of changing or controlling this behaviour? It's very problematic in a project I have.
Thanks!

Error: MissingPluginException(No implementation found for method parse on channel com.julienvignali/phone_number)

After installing and using the plugin,

TextField(
      keyboardType: TextInputType.number,
      onChanged: (value) async {
          print(value);
          try {
              PhoneNumber phoneNumber = await phoneNumberUtil.parse(value);
              print(phoneNumber);
          } on PlatformException {
              print('error');
          }
          setState(() {
               _phoneNumber = value;
          });
      },
 )

it is throwing an error

Error: MissingPluginException(No implementation found for method parse on channel com.julienvignali/phone_number)

Unhandled Exception: MissingPluginException(No implementation found for method parse on channel com.julienvignali/phone_number)

run example on ios emulator
flutter version: 1.9.1
[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: MissingPluginException(No implementation found for method parse on channel com.julienvignali/phone_number)
#0 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:314:7)

#1 PhoneNumber.parse (package:phone_number/src/phone_number.dart:20:21)
#2 _MyAppState.initPlatformState (package:phone_number_example/main.dart:29:36)

#3 _MyAppState.initState (package:phone_number_example/main.dart:21:5)
#4 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4067:58)
#5 ComponentElement.mount (package:flutter/src/widgets/framework.dart:3921:5)
#6 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3103:14)
#7 Element.updateChild (package:flutter/src/widgets/framework.dart:2906:12)
#8 RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1002:16)
#9 RenderObjectToWidgetElement.m<…>

Receiving an error on validating any number on ios

Is there an existing issue for this?

  • I have searched the existing issues

Package/Plugin version

1.0.0

Flutter doctor

Flutter doctor
[flutter] flutter doctor -v
[✓] Flutter (Channel stable, 3.7.12, on macOS 13.3.1 22E261 darwin-arm64, locale en-AE)
    • Flutter version 3.7.12 on channel stable at /Users/amirsaid/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4d9e56e694 (2 weeks ago), 2023-04-17 21:47:46 -0400
    • Engine revision 1a65d409c7
    • Dart version 2.19.6
    • DevTools version 2.20.1

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.12.1

[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).

[✓] VS Code (version 1.77.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.62.0

[✓] Connected device (2 available)
    • Amir Said’s iPhone (mobile) • 00008101-00182D620EF0001E • ios          • iOS 16.4.1 20E252
    • macOS (desktop)             • macos                     • darwin-arm64 • macOS 13.3.1 22E261 darwin-arm64

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 3 categories.
exit code 0

Minimal code example

Code sample
void _doValidate() async {
String phone = "+12344321234";
if (await PhoneNumberUtil().validate(phone) {
        print("Valid");
} else {
print("invalid");
}

Current Behavior

Returns the number as invalid.

Expected Behavior

Return the number as valid.

Steps To Reproduce

Just use the code above and compile on Mac Os for iPhone and test it.

Aditional information

[Client] Updating selectors after delegate addition failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service with pid 95 named com.apple.commcenter.coretelephony.xpc was invalidated from this process." UserInfo={NSDebugDescription=The connection to service with pid 95 named com.apple.commcenter.coretelephony.xpc was invalidated from this process.}

Device used: iPhone 12 Pro

PlatformException(InvalidNumber, Number 3 is invalid, null, null)

The following error is thrown whenever the validate function is called for the first time.

    StandardMethodCodec.decodeEnvelope(package:flutter/src/services/message_codecs.dart:607)
    MethodChannel._invokeMethod(package:flutter/src/services/platform_channel.dart:177)
    MethodChannel.invokeMapMethod(package:flutter/src/services/platform_channel.dart:377)
    PhoneNumberUtil.validate(package:phone_number/src/phone_number_util.dart:109)```

Critical: Migration to Federated Plugin [Action plan]

Description

Firstly, before implementing web support for the plugin. It needs platform separation.

The main package should be platform agnostic. Three different platform-specific packages need to be created instead, along with the platform interface.

So the new package structure should be:

  • phone_number (main)
  • phone_number_platform_inteface
  • phone_number_android
  • phone_number_ios
  • phone_number_web (#44)

@deandreamatias I need your help here. You can create those remaining repositories on flutter-form-builder-ecosystem.

Roadmap:

  1. Create required subdivision folders
  2. Working out platform interface
  3. Migrating old platform code to platform-specific repos.
  4. Testing (Android, iOS)
  5. Merging the changes into main in actual phone_number repo.
  6. Publishing (platform-specific -> unlisted packages) (@deandreamatias)

ld: warning: Could not find auto-linked library 'swiftFoundation' when including 0.6.2+4 in new empty flutter project

Hitting this in a new empty flutter project when including the latest package:

  • ld: symbol(s) not found for architecture x86_64
    steps:
  • new flutter project
  • flutter run - runs successfully on simulator for iPhone 11 Pro (13.6)
  • include 0.6.2+4 in pubspec.yaml
  • flutter run - same target simulator results in ld: symbol(s) not found for architecture x86_64

Here is the flutter doctor output, is there anything else I'm missing in the config possibly? Thanks!

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.20.2, on Mac OS X 10.15.6 19G2021, locale en-US)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.40.2)
[✓] Connected device (2 available)

• No issues found!

Issue

Update README with description and documentation on how to use

Is there anyway to force disable RTL in this plugin?

Hi there, I am trying to implement this into my app but when tried to change my Local language to Arabic the text box direction is changed to RTL. Is there any workaround so I can force disable RTL mode of the textbox?

False positive


Future<bool> _validatePhone(String? value) async {
  if (value == null) return false;
  try {
    final plugin = PhoneNumberUtil();

    if (!value.startsWith("+")) {
      value = "+1$value";
    }

    final phoneNumber = await plugin.parse(value, regionCode: "US");

    final regions =
        await plugin.allSupportedRegions();

    String regionCode;
    try {
      regionCode = regions
          .firstWhere(
            (element) =>
                element.prefix == int.tryParse(phoneNumber.countryCode),
          )
          .code;
    } on StateError {
      regionCode = 'US';
    }
    return await plugin.validate(value, regionCode);
  } catch (e) {
    return false;
  }
}

This code returns True for number "+18588888"
Screenshot 2022-06-09 at 16 37 43

For some reason it's parsed as "+12468588888"

/phone_number/phone_number.modulemap' not found

Not sure why i'm getting this error. Added phone_number but did not initially add all the dependencies needed for iOS. Now it wont build and is showing this error.

How do I create this modulemap it is mentioning...

MissingPluginException(No implementation found for method validate on channel com.julienvignali/phone_number)

When use await PhoneNumberUtil().validate on windows platform:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method validate on channel com.julienvignali/phone_number)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:294:7)

#1 MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:499:43)

#2 PhoneNumberUtil.validate (package:phone_number/src/phone_number_util.dart:109:20)

#3 _MyHomePageState.createClipboardListener.. (package:clip_to_call/main.dart:137:28)

Originally posted by @necrox87 in #89 (comment)

Very confusing validate function

Seriously I cannot think of any tiny good reason why you need to catch the exception for invalid output but at the same return a boolean to tell if the value is correct or not.

bool isvalid = await PhoneNumberUtil().validate('...')

Unhandled Exception: PlatformException(InvalidNumber, Number ... is invalid, null, null)

Simplify example code

Environment

Package version: 0.12.0+2

Description

What you'd like to happen: Example application will be easy to understand and run

Alternatives you've considered: Remove complex state management

RangeError (index): Invalid value: Valid value range is empty: 0.

Environment

Package version:

Flutter doctor
[✓] Flutter (Channel stable, 3.0.1, on macOS 12.3.1 21E258 darwin-arm, locale en-RO)
    • Flutter version 3.0.1 at /Users/ka/dev/tools/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision fb57da5f94 (8 weeks ago), 2022-05-19 15:50:29 -0700
    • Engine revision caaafc5604
    • Dart version 2.17.1
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/ka/Library/Android/sdk
    • Platform android-32, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2020.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.10+0-b96-7249189)

[✓] VS Code (version 1.69.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.44.0

[✓] Connected device (4 available)
    • iPhone (mobile)                     • b4edf88c07bc09f8c4aa16ca492b0ddbbc369aa1 • ios            • iOS 15.5 19F77
    • iPhone SE (3rd generation) (mobile) • 13CC9010-3592-4FC3-A31E-3B89FEE726F6     • ios            • com.apple.CoreSimulator.SimRuntime.iOS-15-5 (simulator)
    • macOS (desktop)                     • macos                                    • darwin-arm64   • macOS 12.3.1 21E258 darwin-arm
    • Chrome (web)                        • chrome                                   • web-javascript • Google Chrome 103.0.5060.114
    ! Error: iPhone is busy: Fetching debug symbols for iPhone. Xcode will continue when iPhone is finished. (code -10)

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
Code sample
I cannot reproduce it but I am getting over 40 crash reports about this.

Description

Expected behavior: Do not crash

Current behavior: Crash

Steps to reproduce

I cannot reproduce it but I have over 40 crash resports about this.

Stacktrace/Logcat

0 ??? 0x0 _OneByteString.codeUnitAt (dart:core)
1 ??? 0x0 StringExt.findAdditionRange + 43 (utils.dart:43)
2 ??? 0x0 PhoneNumberEditingController._onStopFormatting + 185 (controller.dart:185)
3 ??? 0x0 PhoneNumberEditingController._formatAndSet + 145 (controller.dart:145)
4 ??? 0x0 PhoneNumberEditingController.value= + 89 (controller.dart:89)
5 ??? 0x0 EditableTextState._value= + 2211 (editable_text.dart:2211)
6 ??? 0x0 EditableTextState._formatAndSetValue + 2617 (editable_text.dart:2617)
7 ??? 0x0 EditableTextState.updateEditingValue + 1967 (editable_text.dart:1967)
8 ??? 0x0 TextInput._handleTextInputInvocation + 1730 (text_input.dart:1730)
9 ??? 0x0 MethodChannel._handleAsMethodCall + 404 (platform_channel.dart:404)
10 ??? 0x0 MethodChannel.setMethodCallHandler. + 397 (platform_channel.dart:397)
11 ??? 0x0 _DefaultBinaryMessenger.setMessageHandler. + 380 (binding.dart:380)
12 ??? 0x0 _DefaultBinaryMessenger.setMessageHandler. + 377 (binding.dart:377)

FAILURE: Build failed with an exception.

I am trying to use this library but this is what I keep getting:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':phone_number'.
> Could not resolve all artifacts for configuration ':phone_number:classpath'.
   > Could not download builder-3.6.1.jar (com.android.tools.build:builder:3.6.1)
      > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.6.1/builder-3.6.1.jar'.
         > Premature end of Content-Length delimited message body (expected: 8,573,693; received: 2,359,280)
   > Could not download bundletool-0.10.3.jar (com.android.tools.build:bundletool:0.10.3)
      > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/0.10.3/bundletool-0.10.3.jar'.
         > Premature end of Content-Length delimited message body (expected: 6,851,122; received: 4,456,416)
> Could not get unknown property 'android' for project ':phone_number' of type org.gradle.api.Project.

Here is the content of my own build.gradle file

 dependencies {
        classpath 'com.android.tools.build:gradle:4.1.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }

Please, how do I resolve this?

Thank you for this amazing library

Issues with Determining the ISO3166 Country Code given a phone number, validation

In our app I'm given a phone number. I don't know what country it is from, but we require the end user to enter the E164 +xxx country code.

With this library I cannot seem to turn a "+1 314 246 xxxx" phone number into the value "US" nor "+1 787 246 xxxx" into "PR"

Our customers are all over the world, and I don't want a "Country Code Picker" either.

LibPhoneNumber can determine that the +1 314 246 xxxx is in the US, I'm not sure why this library does not expose it.

Help!

The big challenge here is that this library uses isValidNumberForRegion() as implemented in this library, in Java:

https://github.com/nashfive/phone_number/blob/d4ff262c4f91b2880f03a0d6072b5c7073772ad4/android/src/main/java/com/julienvignali/phone_number/PhoneNumberPlugin.java#L107

Now I have to know the region ahead of validation, but I don't know it, but it should be implied by the number, not requiring me to include the region.

It would be nice to be able to have access to a different .validate function to match the Google LibPhoneNumber options, such as .isPossibleNumber() and .isValidNumber() rather than the very specific .isValidNumberForRegion()

Without this flexibility and access to the rest of the functionality of libphonenumber, I'm struggling to accomplish reliance on the value that LibPhoneNumber provides!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.