getSimNumbers static method

Future<List<String>> getSimNumbers()

Retrieves the phone numbers associated with the installed SIM cards.

This method invokes a native method named 'getSimNumbers'.

Throws an Exception if permission is not granted or if no SIM numbers are available (indicated by a null, empty, or 'PERMISSION_DENIED' result).

Returns a Future that completes with a List of String containing the SIM card phone numbers.

Implementation

static Future<List<String>> getSimNumbers() async {
  final result = await _channel.invokeMethod<List<dynamic>>('getSimNumbers');
  if (result == null || result.isEmpty || result[0] == 'PERMISSION_DENIED') {
    throw Exception("Permission not granted or no SIM numbers available");
  }
  return result.cast<String>();
}