openMapWithLatLng method
🔹 Open map with lat/lng
Implementation
Future<void> openMapWithLatLng(double latitude, double longitude, {String label = "Here"}) async {
try {
Uri url;
if (Platform.isIOS) {
// iOS → Apple Maps
final encodedLabel = Uri.encodeComponent(label);
url = Uri.parse('http://maps.apple.com/?ll=$latitude,$longitude&q=$encodedLabel');
} else {
// Android → geo: scheme
url = Uri.parse('geo:$latitude,$longitude?q=$latitude,$longitude($label)');
}
await launchUrl(url, mode: LaunchMode.externalApplication);
} catch (error) {
_showError(error.toString());
}
}