sim_info 0.0.1 sim_info: ^0.0.1 copied to clipboard
A Flutter plugin for read SIM information. You can get SIM data for MCC, MNC, country code, etc There are similarities and differences between the data available on Android and iOS. Read the usage.
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:sim_info/sim_info.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _allowsVOIP;
String _carrierName;
String _isoCountryCode;
String _mobileCountryCode;
String _mobileNetworkCode;
@override
void initState() {
super.initState();
getUsimInfo();
}
Future<void> getUsimInfo() 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;
setState(() {
_allowsVOIP = allowsVOIP;
_carrierName = carrierName;
_isoCountryCode = isoCountryCode;
_mobileCountryCode = mobileCountryCode;
_mobileNetworkCode = mobileNetworkCode;
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('USIM Infomation Plugin'),
),
body: Center(
child: Column(
children: <Widget>[
Text('VOIP : $_allowsVOIP '),
Text('CarrierName : $_carrierName'),
Text('ISO CountryCode : $_isoCountryCode'),
Text('Mobile CountryCode : $_mobileCountryCode'),
Text('Mobile NetworkCode : $_mobileNetworkCode'),
],
)),
),
);
}
}