getInstalledMaps method

  1. @override
Future<List<MapType>> getInstalledMaps()
override

Returns the list of MapTypes that have native apps installed. Returns an empty list on platforms that don't support app detection.

Implementation

@override
Future<List<MapType>> getInstalledMaps() async {
  final result = await methodChannel.invokeMethod('getInstalledMaps');
  if (result == null) return [];
  final maps = result as List;
  return maps
      .map((map) {
        final typeName = (map as Map)['mapType'] as String;
        try {
          return MapType.values.byName(typeName);
        } catch (_) {
          return null;
        }
      })
      .whereType<MapType>()
      .toList();
}