launchMapMarker function
Implementation
void launchMapMarker(double latitude, double longitude, String title) async {
final availableMaps = await MapLauncher.installedMaps;
MapType preferredMap = MapType.apple;
// Check if Google Maps is available and set it as the preferred map
if (availableMaps.any((map) => map.mapType == MapType.google)) {
preferredMap = MapType.google;
} else if (!availableMaps.any((map) => map.mapType == MapType.apple)) {
// Handle the scenario where neither Google nor Apple Maps are available
throw 'No compatible maps are installed on the device.';
}
// Launch the map marker with the preferred map
await MapLauncher.showMarker(
mapType: preferredMap,
coords: Coords(latitude, longitude),
title: title,
);
}