carrier_info icon indicating copy to clipboard operation
carrier_info copied to clipboard

Throwing error and returning null on Mobile phone wihtout SimCard injected

Open AymenXD opened this issue 1 year ago • 7 comments

When Trying on a phone where there is no sim card injected, the package throws this error :

PlatformException(no_carrier_name, No carrier name, java.lang.StringIndexOutOfBoundsException: length=0; index=3, null)

AymenXD avatar May 16 '23 10:05 AymenXD

will take a look this week, may I know which commit are you using?

onghuisheng avatar May 16 '23 11:05 onghuisheng

I am using the latest commit of version 2.0.8 . Anyways good job on the plugin, You did a great one !!!!! Keep up the good work.

AymenXD avatar May 16 '23 15:05 AymenXD

can you try replacing this line in pubspec. yaml

  carrier_info: 2.0.8

with these 2 lines:

  carrier_info: 
     git: https://github.com/Zfinix/carrier_info.git

and see if it works?

onghuisheng avatar May 16 '23 16:05 onghuisheng

Still the same problem unfortunately :/ You can reproduce this error by simply removing all the Sim Cards from your Android phone and then running the plugin example.

AymenXD avatar May 16 '23 16:05 AymenXD

Still the same problem unfortunately :/ You can reproduce this error by simply removing all the Sim Cards from your Android phone and then running the plugin example.

I'm unable to repro this issue even when using a device with no sim card inserted.

Did you ran flutter pub get or flutter pub upgrade after changing pubspec.yaml to this?

  carrier_info: 
     git: https://github.com/Zfinix/carrier_info.git

Also, may I know which Android version that you're using?

onghuisheng avatar May 21 '23 14:05 onghuisheng

facing same issue

alfaruqrizqi18 avatar May 30 '23 15:05 alfaruqrizqi18

Still the same problem unfortunately :/ You can reproduce this error by simply removing all the Sim Cards from your Android phone and then running the plugin example.

I'm unable to repro this issue even when using a device with no sim card inserted.

Did you ran flutter pub get or flutter pub upgrade after changing pubspec.yaml to this?

  carrier_info: 
     git: https://github.com/Zfinix/carrier_info.git

Also, may I know which Android version that you're using?

Try this solution

  • Android 12
  • Flutter (Channel stable, 3.3.2, on Microsoft Windows [Version 10.0.19042.1165], locale en-ID) image

alfaruqrizqi18 avatar May 30 '23 22:05 alfaruqrizqi18