getSimInfos method

  1. @override
Future<List<TelephonyInfo>?> getSimInfos()
override

Implementation

@override
Future<List<TelephonyInfo>?> getSimInfos() async {
  try {
    final result = await methodChannel.invokeMethod<String>('getSimInfos');
    if (result == null) return null;
    final rez = await jsonDecode(result);
    return List<TelephonyInfo>.from(rez.map((json) => TelephonyInfo.fromJson(json)) ?? []);
  } on PlatformException catch (e) {
    throw ("Platform Exception: ${e.message}");
  } catch (e) {
    throw ('error ${e.toString()}');
  }
}