aneyzberg / flutter_sim_info

A Flutter plugin for read SIM information.

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

flutter_sim_info

A Flutter plugin for read SIM information.
You can get SIM data for MCC, MNC, country name, etc...

Note: There are similarities and differences between the data available on Android and iOS. Read the usage.

Usage

Import the package

In your flutter project add the dependency:

dependencies:
  ...
  sim_info: ^0.1.1

check it out the installing page.

Use the plugin

Add the following import to your Dart code:

import 'package:sim_info/sim_info.dart';

Use below to get SIM data:

  String _allowsVOIP;
  String _carrierName;
  String _isoCountryCode;
  String _mobileCountryCode;
  String _mobileNetworkCode;

  @override
  void initState() {
    super.initState();
    getSimInfo();
  }

  void getSimInfo() async {
    String allowsVOIP = await SimInfo.getAllowsVOIP;
    String carrierName = await SimInfo.getCarrierName;
    String isoCountryCode = await SimInfo.getIsoCountryCode;
    String mobileCountryCode = await SimInfo.getMobileCountryCode;
    String mobileNetworkCode = await SimInfo.getMobileNetworkCode;
  }

Full list of available SIM data.

Android integration

Beginning with Android 6.0 (API level 23), you must obtain bellow permission before using methods.

Dangerous permissions READ_PHONE_STATE

Error message

"PERMISSION_DENIED" // In android, you use methods before get permission.

"SIM_STATE_NOT_READY" // In both, cannot found SIM card in your device.

Screenshots

screenshot

API details

See the WIKI for more API details.

Issues and feedback

Please file issues to send feedback or report a bug. Thank you!

License

MIT license.

About

A Flutter plugin for read SIM information.

https://pub.dev/packages/sim_info

License:MIT License


Languages

Language:Dart 32.8%Language:Java 26.3%Language:Ruby 24.4%Language:Swift 13.8%Language:Objective-C 2.7%