import 'package:map_launcher/map_launcher.dart';

class MapUtils {
  MapUtils._();

  static Future<void> openMapByLatLon(double latitude, double longitude) async {
    if (await MapLauncher.isMapAvailable(MapType.google) ?? false) {
      await MapLauncher.showDirections(
        mapType: MapType.google,
        destination: Coords(latitude, longitude),
      );
    } else {
      final availableMaps = await MapLauncher.installedMaps;
      await availableMaps.first.showDirections(
        destination: Coords(latitude, longitude),
      );
    }
  }
}
