From 084f99f7b7e21405f78a35c2d65d02c6cbe8be97 Mon Sep 17 00:00:00 2001 From: Rikaz Zarook <62603541+mzrikaz@users.noreply.github.com> Date: Mon, 5 May 2025 11:14:25 +0530 Subject: [PATCH 1/2] Upgraded: Flutter SDK --- pubspec.yaml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index 6573925..cbe94ee 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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 , Kwangwoo You , Junyeong Cho -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: From 504c4b3e366e03bf78b6be95da31431f7c02fdad Mon Sep 17 00:00:00 2001 From: Rikaz Zarook <62603541+mzrikaz@users.noreply.github.com> Date: Mon, 5 May 2025 11:15:08 +0530 Subject: [PATCH 2/2] Added: Dart 3 Compatibility --- lib/sim_info.dart | 59 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/lib/sim_info.dart b/lib/sim_info.dart index e44b0dc..804743a 100644 --- a/lib/sim_info.dart +++ b/lib/sim_info.dart @@ -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 get getAllowsVOIP async { - bool value = await _channel.invokeMethod('allowsVOIP'); - return value.toString(); + static const MethodChannel _channel = MethodChannel('flutter.moum.sim_info'); + + static Future getAllowsVOIP async { + try { + final value = await _channel.invokeMethod('allowsVOIP'); + return value; + } catch (e) { + print('Error getting allowsVOIP: $e'); + return null; + } } - static Future get getCarrierName async { - return await _channel.invokeMethod('carrierName'); + static Future getCarrierName async { + try { + final value = await _channel.invokeMethod('carrierName'); + return value; + } catch (e) { + print('Error getting carrierName: $e'); + return null; + } } - static Future get getIsoCountryCode async { - return await _channel.invokeMethod('isoCountryCode'); + static Future getIsoCountryCode async { + try { + final value = await _channel.invokeMethod('isoCountryCode'); + return value; + } catch (e) { + print('Error getting isoCountryCode: $e'); + return null; + } } - static Future get getMobileCountryCode async { - return await _channel.invokeMethod('mobileCountryCode'); + static Future getMobileCountryCode async { + try { + final value = await _channel.invokeMethod('mobileCountryCode'); + return value; + } catch (e) { + print('Error getting mobileCountryCode: $e'); + return null; + } } - static Future get getMobileNetworkCode async { - return await _channel.invokeMethod('mobileNetworkCode'); + static Future getMobileNetworkCode async { + try { + final value = await _channel.invokeMethod('mobileNetworkCode'); + return value; + } catch (e) { + print('Error getting mobileNetworkCode: $e'); + return null; + } } - }