openMapWithPlaceId method
🔹 Open map with Google PlaceId
Implementation
Future<void> openMapWithPlaceId(String placeId, {String label = "Here"}) async {
try {
Uri url;
if (Platform.isIOS) {
// iOS does not support PlaceId → use Google Maps web link
url = Uri.parse('https://www.google.cn/maps/search/?api=1&query=$label&query_place_id=$placeId');
} else {
// Android → Google Maps web link (safer than geo: for placeId)
url = Uri.parse('https://www.google.cn/maps/search/?api=1&query=$label&query_place_id=$placeId');
}
await launchUrl(url, mode: LaunchMode.externalApplication);
} catch (error) {
_showError(error.toString());
}
}