Code Monkey home page Code Monkey logo

flutter-libphonenumber's People

Contributors

andersunloc avatar augustzf avatar axldyb avatar benql avatar bhavin-concetto avatar edwinnyawoli avatar elvisun avatar emostar avatar kamiff avatar lohanbodevan avatar natintosh avatar pr-1 avatar robsonql avatar thehypnoo 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

Watchers

 avatar  avatar  avatar

flutter-libphonenumber's Issues

isValidPhoneNumber returns false in case of MissingPluginException

MissingPluginException: if the method has not been implemented by a platform plugin.

The try-catch block around the invokeMethod hides the MissingPluginException error to developers by returning false, maybe it would be better to catch only the PlatformException to notify developers instead of just returning false.

Example:

try {
     return await method();
} on PlatformException catch (_) {
     return false;
}

Repository still maintained?

Hello @emostar ,

Thank you for the plugin, it's the good base I was looking for with my project.

I will need to implement new functionalities so I was thinking about opening new Pull Requests in your repo, but I can see that you haven't replied in months to the ones that have already been opened.

Are you not interested anymore in maintaining this repo? If you are then I will open PRs.

Thank you

Deprecated version of the Android embedding

The plugin `libphonenumber2` uses a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.

Null Safety Update ?

Hi @emostar Thanks for this package. I am planning to create a PR for null safety version if you're not already working on it.

Exception thrown if empty string is passed to any of the methods

E/flutter ( 6944): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(NumberParseException, The string supplied did not seem to be a phone number., null)
E/flutter ( 6944): #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:569:7)
E/flutter ( 6944): #1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:321:33)
E/flutter ( 6944): <asynchronous suspension>
E/flutter ( 6944): #2      PhoneNumberUtil.normalizePhoneNumber (package:libphonenumber/libphonenumber.dart:36:27)
E/flutter ( 6944): #3      _MyHomePageState.setValue (package:intl_helper_test/main.dart:53:31)
E/flutter ( 6944): #4      _MyHomePageState.build.<anonymous closure> (package:intl_helper_test/main.dart:45:15)
E/flutter ( 6944): #5      new TextFormField.<anonymous closure>.onChangedHandler (package:flutter/src/material/text_form_field.dart:160:20)
E/flutter ( 6944): #6      EditableTextState._formatAndSetValue (package:flutter/src/widgets/editable_text.dart:1607:14)
E/flutter ( 6944): #7      EditableTextState.updateEditingValue (package:flutter/src/widgets/editable_text.dart:1208:5)
E/flutter ( 6944): #8      TextInput._handleTextInputInvocation (package:flutter/src/services/text_input.dart:965:36)
E/flutter ( 6944): #9      MethodChannel._handleAsMethodCall (package:flutter/src/services/platform_channel.dart:402:55)
E/flutter ( 6944): #10     MethodChannel.setMethodCallHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:370:54)
E/flutter ( 6944): #11     _DefaultBinaryMessenger.handlePlatformMessage (package:flutter/src/services/binding.dart:200:33)
E/flutter ( 6944): #12     _invoke3.<anonymous closure> (dart:ui/hooks.dart:303:15)
E/flutter ( 6944): #13     _rootRun (dart:async/zone.dart:1126:13)
E/flutter ( 6944): #14     _CustomZone.run (dart:async/zone.dart:1023:19)
E/flutter ( 6944): #15     _CustomZone.runGuarded (dart:async/zone.dart:925:7)
E/flutter ( 6944): #16     _invoke3 (dart:ui/hooks.dart:302:10)
E/flutter ( 6944): #17     _dispatchPlatformMessage (dart:ui/hooks.dart:162:5)
E/flutter ( 6944): 

Publish the latest PR

Hello @emostar 👋 could you please publish the latest PR as I have a package that's dependent on it and pub publish wouldn't lemme publish a package dependent on a git repo. Thanks

java.lang.IllegalStateException: Reply already submitted

I have the following service

class ContactsService with ChangeNotifier {
  LoadingState _state = LoadingState.uninitialized;
  List<MobileContactModel> _mobileContacts = List<MobileContactModel>();

  LoadingState get state => _state;
  List<MobileContactModel> get mobileContacs => _mobileContacts.toList();

  ContactsService() {
    refreshContacts();
  }

  Future<void> refreshContacts() async {
    bool hasPermission = await Permission.contacts.request().isGranted;

    if (!hasPermission) {
      _state = LoadingState.permissionDenied;
      notifyListeners();
    }

    _state = LoadingState.loading;
    notifyListeners();

    List<MobileContactModel> rawContacts = (await contactsService.ContactsService.getContacts(withThumbnails: false))
        .where((contact) => contact.phones.any((iterable) => iterable.label == 'mobile'))
        .map((contact) => MobileContactModel(
            contact.displayName, contact.phones.firstWhere((phoneNumber) => phoneNumber.label == 'mobile').value))
        .toList();

    _mobileContacts = await validateContacts(rawContacts);

    _state = LoadingState.loaded;
    notifyListeners();
  }

  Future<List<MobileContactModel>> validateContacts(List<MobileContactModel> rawContacts) async {
    List<Future<MobileContactModel>> validations = List<Future<MobileContactModel>>();

    for (MobileContactModel rawContact in rawContacts) validations.add(_validateContact(rawContact));

    var test = (await Future.wait(validations)).toList();
    test.removeWhere((value) => value == null);
    return test;
  }

  Future<MobileContactModel> _validateContact(MobileContactModel rawContact) async {
    return await _isValidMobileNumber(rawContact.phonenumber) ? rawContact : null;
  }

  Future<bool> _isValidMobileNumber(String phoneNumber) async {
    if (phoneNumber.isEmpty) return false;

    try {
      PhoneNumberType type = await PhoneNumberUtil.getNumberType(phoneNumber: phoneNumber, isoCode: 'NL');
      return type == PhoneNumberType.mobile;
    } catch (error) {
      return false;
    }
  }
}

But the _isValidMobileNumber() keeps throwing the following error. Is there a way to catch this error? Is there anything I can do about this? Or is it an error that's in the package?

E/MethodChannel#codeheadlabs.com/libphonenumber(13840): Failed to handle method call
E/MethodChannel#codeheadlabs.com/libphonenumber(13840): java.lang.IllegalStateException: Reply already submitted
E/MethodChannel#codeheadlabs.com/libphonenumber(13840):         at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:148)
E/MethodChannel#codeheadlabs.com/libphonenumber(13840):         at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:234)
E/MethodChannel#codeheadlabs.com/libphonenumber(13840):         at com.codeheadlabs.libphonenumber.LibphonenumberPlugin.formatAsYouType(LibphonenumberPlugin.java:157)
E/MethodChannel#codeheadlabs.com/libphonenumber(13840):         at com.codeheadlabs.libphonenumber.LibphonenumberPlugin.onMethodCall(LibphonenumberPlugin.java:44)
E/MethodChannel#codeheadlabs.com/libphonenumber(13840):         at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231)
E/MethodChannel#codeheadlabs.com/libphonenumber(13840):         at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
E/MethodChannel#codeheadlabs.com/libphonenumber(13840):         at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
E/MethodChannel#codeheadlabs.com/libphonenumber(13840):         at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#codeheadlabs.com/libphonenumber(13840):         at android.os.MessageQueue.next(MessageQueue.java:336)
E/MethodChannel#codeheadlabs.com/libphonenumber(13840):         at android.os.Looper.loop(Looper.java:174)
E/MethodChannel#codeheadlabs.com/libphonenumber(13840):         at android.app.ActivityThread.main(ActivityThread.java:7356)
E/MethodChannel#codeheadlabs.com/libphonenumber(13840):         at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#codeheadlabs.com/libphonenumber(13840):         at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/MethodChannel#codeheadlabs.com/libphonenumber(13840):         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
E/DartMessenger(13840): Uncaught exception in binary message listener
E/DartMessenger(13840): java.lang.IllegalStateException: Reply already submitted
E/DartMessenger(13840):         at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:148)
E/DartMessenger(13840):         at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:249)
E/DartMessenger(13840):         at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
E/DartMessenger(13840):         at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
E/DartMessenger(13840):         at android.os.MessageQueue.nativePollOnce(Native Method)
E/DartMessenger(13840):         at android.os.MessageQueue.next(MessageQueue.java:336)
E/DartMessenger(13840):         at android.os.Looper.loop(Looper.java:174)
E/DartMessenger(13840):         at android.app.ActivityThread.main(ActivityThread.java:7356)
E/DartMessenger(13840):         at java.lang.reflect.Method.invoke(Native Method)
E/DartMessenger(13840):         at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
E/DartMessenger(13840):         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

I am using the latest Flutter version and libphonenumber: ^1.0.1

Warning regarding iOS build target

When building i get this:

warning: The iOS deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set
to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99. (in target 'libPhoneNumber-iOS' from project 'Pods')
/Users/vytautaspranskunas/Desktop/Development/senioassist-mobile/ios/Pods/Pods.xcodeproj:

Getting MissingPluginException

I tried using the package as shown in the example provided:

bool isValid = await PhoneNumberUtil.isValidPhoneNumber(
  phoneNumber: phoneNumber,
  isoCode: countryCode
);

However, the following exception is thrown:

E/flutter ( 3423): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: MissingPluginException(No implementation found for method isValidPhoneNumber on channel codeheadlabs.com/libphonenumber)
E/flutter ( 3423): #0      MethodChannel.invokeMethod 
package:flutter/…/services/platform_channel.dart:314
E/flutter ( 3423): <asynchronous suspension>
E/flutter ( 3423): #1      PhoneNumberUtil.isValidPhoneNumber  (package:libphonenumber/libphonenumber.dart:26:27)
E/flutter ( 3423): <asynchronous suspension>
E/flutter ( 3423): #2      PhoneNumberFormatService.isValid 
package:whatsapp/services/phone_number_format_service.dart:13
E/flutter ( 3423): <asynchronous suspension>
E/flutter ( 3423): #3      _SignUpState._onNext 
package:whatsapp/…/signup/signup.dart:93
E/flutter ( 3423): <asynchronous suspension>
E/flutter ( 3423): #4      _SignUpState.build.<anonymous closure> 
package:whatsapp/…/signup/signup.dart:209
E/flutter ( 3423): #5      _InkResponseState._handleTap 
package:flutter/…/material/ink_well.dart:635
E/flutter ( 3423): #6      _InkResponseState.build.<anonymous closure> 
package:flutter/…/material/ink_well.dart:711
E/flutter ( 3423): #7      GestureRecognizer.invokeCallback 
package:flutter/…/gestures/recognizer.dart:182
E/flutter ( 3423): #8      TapGestureRecognizer._checkUp 
package:flutter/…/gestures/tap.dart:365
E/flutter ( 3423): #9      TapGestureRecognizer.handlePrimaryPointer 
package:flutter/…/gestures/tap.dart:275
E/flutter ( 3423): #10     PrimaryPointerGestureRecognizer.handleEvent 
package:flutter/…/gestures/recognizer.dart:455
E/flutter ( 3423): #11     PointerRouter._dispatch 
package:flutter/…/gestures/pointer_router.dart:75
E/flutter ( 3423): #12     PointerRouter.route 
package:flutter/…/gestures/pointer_router.dart:102
E/flutter ( 3423): #13     _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent 
package:flutter/…/gestures/binding.dart:218
E/flutter ( 3423): #14     _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent 
package:flutter/…/gestures/binding.dart:198
E/flutter ( 3423): #15     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent 
package:flutter/…/gestures/binding.dart:156
E/flutter ( 3423): #16     _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue 
package:flutter/…/gestures/binding.dart:102
E/flutter ( 3423): #17     _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket 
package:flutter/…/gestures/binding.dart:86
E/flutter ( 3423): #18     _rootRunUnary  (dart:async/zone.dart:1136:13)
E/flutter ( 3423): #19     _CustomZone.runUnary  (dart:async/zone.dart:1029:19)
E/flutter ( 3423): #20     _CustomZone.runUnaryGuarded  (dart:async/zone.dart:931:7)
E/flutter ( 3423): #21     _invoke1  (dart:ui/hooks.dart:250:10)
E/flutter ( 3423): #22     _dispatchPointerDataPacket  (dart:ui/hooks.dart:159:5)
E/flutter ( 3423):

RegionInfo Formatted result unexpected

im have a code for autoformat like this:

Future<String> getFormattedPhoneNumber(String phoneNumber) async {
    final RegionInfo regionInfo = await PhoneNumberUtil.getRegionInfo(phoneNumber: phoneNumber, isoCode: 'id');
    return regionInfo.formattedPhoneNumber ?? phoneNumber;
}

when the phoneNumber is 0877123 the regionInfo result is [RegionInfo prefix=62, iso=ID, formatted=0877123]
when the phoneNumber is 08771234 the regionInfo result is [RegionInfo prefix=62, iso=ID, formatted=8771234]

in formatted property the 0 is missing.

MissingPluginException for normalizePhoneNumber()

Running the given sample program as-is.
In the code, passing a valid phone number with iso code 'IN' to normalizePhoneNumber().
Clicking on "Show Details" button throws below exception:

Error: MissingPluginException(No implementation found for method normalizePhoneNumber on channel codeheadlabs.com/libphonenumber)
    at Object.throw_ [as throw] (http://localhost:51447/dart_sdk.js:5037:11)
    at MethodChannel._invokeMethod (http://localhost:51447/packages/flutter/src/services/system_channels.dart.lib.js:943:21)
    at _invokeMethod.next (<anonymous>)
    at http://localhost:51447/dart_sdk.js:37374:33
    at _RootZone.runUnary (http://localhost:51447/dart_sdk.js:37245:59)
    at _FutureListener.thenAwait.handleValue (http://localhost:51447/dart_sdk.js:32501:29)
    at handleValueCallback (http://localhost:51447/dart_sdk.js:33028:49)
    at Function._propagateToListeners (http://localhost:51447/dart_sdk.js:33066:17)
    at _Future.new.[_completeWithValue] (http://localhost:51447/dart_sdk.js:32914:23)
    at async._AsyncCallbackEntry.new.callback (http://localhost:51447/dart_sdk.js:32935:35)
    at Object._microtaskLoop (http://localhost:51447/dart_sdk.js:37497:13)
    at _startMicrotaskLoop (http://localhost:51447/dart_sdk.js:37503:13)
    at http://localhost:51447/dart_sdk.js:33274:9

Same exception is thrown for other functions also- getRegionInfo(), getNameForNumber()

The only function that does not throw exception is isValidPhoneNumber(), but this returns false always, another issue is already open for the same.

Latest Country phone numbers are not validating

Each country has service provider for mobile phone numbers, so the latest phone number formats are no longer being validated with this library, i suppose its now using an old version of libphonenumber.

It returns false but the number will be correct and using a correct country code.

Not working when minimum iOS version is iOS 11?

When you create a flutter project with flutter create the minimum iOS that it works on is iOS 9. But in my case i use AWS Amplify, but to use it I had to bump up the minimum iOS version to iOS 11. After the iOS bump the as you type formatting stopped working.

isValidPhoneNumber throws exception instead of returning false

When I passed "+1" to isValidPhoneNumber, it throws the following exception:

E/flutter (13120): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(NumberParseException, The string supplied did not seem to be a phone number., null)

isn't the point to return false when it's not a phone number?

I'm planning on adding a try catch block around this function, happy to submit a PR if approved, does that make sense?

isValidPhoneNumber always returns false when called from flutter test

The following valid test case always fails
`
import 'package:flutter_test/flutter_test.dart';
import 'package:libphonenumber/libphonenumber.dart';

void main() {
test('Verify valid phone number', () async {
//A valid phone number and country code
var res = await PhoneNumberUtil.isValidPhoneNumber(phoneNumber: "xxxxxxxxxx", isoCode: "IN");
expect(res, true);
});
}
`

it validate landline number also i don't want this.

Hi, I want to use this library for international phone number validation. but this also validate landline number. can you please give option for type like 'mobile', 'landline' when validating it. help.

isValidPhoneNumber not working well on IOS on some SG mobile number

Describe the bug
Some new Singapore mobile numbers(e.g. +65 8050 3530, +65 8950 3530) are invalid on IOS, but working fine on Android

Package version
libphonenumber: ^2.0.2

To Reproduce
Steps to reproduce the behavior:

bool isValid = await PhoneNumberUtil.isValidPhoneNumber(phoneNumber: 80503530 , isoCode: 'SG');
 print(isValid);

The expected behavior is to get true when printing isValid, but it returns false.

Does anyone have any suggestions to work around this? Thank you.

Add support for web platform

I am using a library that depends on this libphonenumber library. When I run my app on the web browser, on localhost, I've been getting MissingPluginException errors coming from libphonenumber library. I have no issues with native apps.

pubspec.yaml:
international_phone_input: ^1.0.4

Error:
Error: MissingPluginException(No implementation found for method isValidPhoneNumber on channel codeheadlabs.com/libphonenumber) at Object.throw_ [as throw] (http://localhost:54687/dart_sdk.js:4773:11) at MethodChannel._invokeMethod (http://localhost:54687/packages/flutter/src/services/platform_channel.dart.lib.js:398:21)

Is there anything I can do to circumvent this?

Out of date

Hi @emostar , I see this package is out of date. How do you see to pass the owner to someone else? I would be interested in updating the plugin.

Thank you.

Android embedding Warning on latest Flutter Master branch

The plugins libphonenumber use a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if these plugins support the Android V2 embedding. Otherwise, consider removing them since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.

[✓] Flutter (Channel master, 2.4.0-5.0.pre.144, on macOS 11.4 20F71 darwin-x64,
    locale en-ZA)
    • Flutter version 2.4.0-5.0.pre.144 at /Users/theunodebruin/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7f26dbe0d4 (46 minutes ago), 2021-07-21 21:51:06 -0700
    • Engine revision 2c9000e28c
    • Dart version 2.14.0 (build 2.14.0-341.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/theunodebruin/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /Users/theunodebruin/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5.1, Build version 12E507
    • CocoaPods version 1.10.1

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

[✓] Android Studio (version 4.2)
    • Android Studio at /Users/theunodebruin/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/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.8+10-b944.6916264)

[✓] Android Studio (version 4.2)
    • Android Studio at /Users/theunodebruin/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7486908/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.8+10-b944.6916264)

[✓] IntelliJ IDEA Ultimate Edition (version 2021.1.3)
    • IntelliJ at /Users/theunodebruin/Applications/JetBrains Toolbox/IntelliJ
      IDEA Ultimate.app
    • Flutter plugin version 58.0.3
    • Dart plugin version 211.7727

[✓] IntelliJ IDEA Ultimate Edition (version 2021.1.3)
    • IntelliJ at /Users/theunodebruin/Library/Application
      Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/211.7628.21/IntelliJ IDEA.app
    • 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

[✓] Connected device (2 available)
    • iPhone 12 Pro Max (mobile) • 903ED170-BCC4-482B-814A-DBBACD7A0FDE • ios
      • com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
    • Chrome (web)               • chrome                               •
      web-javascript • Google Chrome 91.0.4472.164

• No issues found!

Bug while parsing +17345465

libPhoneNumber.parse("+17345465") returns {international: +1 268-734-5465, national: (268) 734-5465, type: mobile, e164: +12687345465, country_code: 1, national_number: 2687345465}.

Unsure from where does 268 comes from. We haven't seen this behavior with any other number.

Can someone explain the rationale here?

Thank you

Failed to build to compileSdkVersion 31

When trying to build Flutter app compiling for Android SDK version 31, build fails with the following error:

Execution failed for task ':libphonenumber:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
   > Android resource linking failed
     ERROR:/Users/xxxx/.gradle/caches/transforms-3/d647e4cf153df5c584ca88f6d0c0ffec/transformed/core-1.7.0/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.

Configuration

libphonenumber Version: 2.0.2
Flutter Version: 2.10.2

Platform:

  • 📱 iOS
  • 🤖 Android

Mobile number in CIV got changed from 8 to 10 digits

All ORANGE cell phone numbers after the country code (+225) now start with 07
All MTN cell phone numbers after the country code (+225) now start with 05
All MOOV cell phone numbers after the country code (+225) now start with 01

Can we have this fixed please?

we still haven't upgraded our project to flutter 2.0, can you please verify if this issue is resolved in the newer versions?

LibphonenumberPlugin.java uses or overrides a deprecated API

Getting the below error while trying to run the app i Android emulator (SDK 28), gradle level minSDK set to 23. Any idea how to fix ?

Launching lib/main.dart on Android SDK built for x86 in debug mode...
lib/main.dart:1
Note: /usr/local/Caskroom/flutter/2.0.3/flutter/.pub-cache/hosted/pub.dartlang.org/libphonenumber-2.0.0/android/src/main/java/com/codeheadlabs/libphonenumber/LibphonenumberPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

formatAsYouType is not working on Flutter Web

I am trying to use the formatAsYouType method for a Flutter app and everything is working fine on mobile. However when I try to use it for the web the await does not seem to ever finish and just hangs up.

I have it inside an async function which looks like the following:

onSubmit: (Map<String, dynamic> phoneData) async {
          print("################______${phoneData['phone']}");
          final formattedNumber = await PhoneNumberUtil.formatAsYouType(
            phoneNumber: phoneData['phone'],
            isoCode: phoneData['countryCode'].code,
          );

          print("################______$formattedNumber");
}

When I run this function, the first print statement will work, however the second never get printed because the formatAsYouType method is just hanging up.

I then added it inside a try catch and the error I am getting is
MissingPluginException(No implementation found for method formatAsYouType on channel codeheadlabs.com/libphonenumber)

International Format is Missing

Hi, is it possible to have also the International Format of a phone number available?
At the moment we can retrieve only the national one

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.