Skip to content

Dart 3 Compatibility Added #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 42 additions & 17 deletions lib/sim_info.dart
Original file line number Diff line number Diff line change
@@ -1,31 +1,56 @@
import 'dart:async';
import 'dart:io';

import 'package:flutter/services.dart';

class SimInfo {
static const MethodChannel _channel =
const MethodChannel('flutter.moum.sim_info');

static Future<String> get getAllowsVOIP async {
bool value = await _channel.invokeMethod('allowsVOIP');
return value.toString();
static const MethodChannel _channel = MethodChannel('flutter.moum.sim_info');

static Future<bool?> getAllowsVOIP async {
try {
final value = await _channel.invokeMethod<bool>('allowsVOIP');
return value;
} catch (e) {
print('Error getting allowsVOIP: $e');
return null;
}
}

static Future<String> get getCarrierName async {
return await _channel.invokeMethod('carrierName');
static Future<String?> getCarrierName async {
try {
final value = await _channel.invokeMethod<String>('carrierName');
return value;
} catch (e) {
print('Error getting carrierName: $e');
return null;
}
}

static Future<String> get getIsoCountryCode async {
return await _channel.invokeMethod('isoCountryCode');
static Future<String?> getIsoCountryCode async {
try {
final value = await _channel.invokeMethod<String>('isoCountryCode');
return value;
} catch (e) {
print('Error getting isoCountryCode: $e');
return null;
}
}

static Future<String> get getMobileCountryCode async {
return await _channel.invokeMethod('mobileCountryCode');
static Future<String?> getMobileCountryCode async {
try {
final value = await _channel.invokeMethod<String>('mobileCountryCode');
return value;
} catch (e) {
print('Error getting mobileCountryCode: $e');
return null;
}
}

static Future<String> get getMobileNetworkCode async {
return await _channel.invokeMethod('mobileNetworkCode');
static Future<String?> getMobileNetworkCode async {
try {
final value = await _channel.invokeMethod<String>('mobileNetworkCode');
return value;
} catch (e) {
print('Error getting mobileNetworkCode: $e');
return null;
}
}

}
12 changes: 4 additions & 8 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
name: sim_info
description: A Flutter plugin for read SIM information. You can get SIM data for MCC, MNC, country name, etc.
version: 0.1.3
publisher: Eungi Kim <eungikim.me@gmail.com>, Kwangwoo You <rhkddn1657@gmail.com>, Junyeong Cho <pom0894@naver.com>
homepage: https://github.com/flutter-moum/flutter_sim_info


description: A Flutter plugin to retrieve SIM information
version: 0.1.4
environment:
sdk: ">=2.1.0 <3.0.0"
flutter: ">=1.12.0 <2.0.0"
sdk: ">=3.0.0 <4.0.0"
flutter: ">=3.10.0"

dependencies:
flutter:
Expand Down