openMapWithAddress method
🔹 Open map with formatted address
Implementation
Future<void> openMapWithAddress(String formattedAddress) async {
try {
Uri url;
final query = Uri.encodeComponent(formattedAddress);
if (Platform.isIOS) {
// iOS → Apple Maps
url = Uri.parse('http://maps.apple.com/?q=$query');
} else {
// Android → geo: scheme
url = Uri.parse('geo:0,0?q=$query');
}
await launchUrl(url, mode: LaunchMode.externalApplication);
} catch (error) {
_showError(error.toString());
}
}