getMailApps method

  1. @override
Future<List<MailApp>> getMailApps()
override

Gets the list of available email apps on the device

Implementation

@override
Future<List<MailApp>> getMailApps() async {
  try {
    final List<dynamic>? result = await methodChannel.invokeMethod(
      'getMailApps',
    );
    if (result == null) return [];

    return result
        .cast<Map<dynamic, dynamic>>()
        .map((map) => MailApp.fromMap(Map<String, dynamic>.from(map)))
        .toList();
  } on PlatformException catch (e) {
    debugPrint('Error getting mail apps: ${e.message}');
    return [];
  }
}