Reputation: 31
In flutter code to open maps is like this. It is working on google but not launching apple map url. Might be small mistake or missing something
String addrs = '';
addrs = '###';
String googleUrl =
'comgooglemaps://?q=${Uri.encodeComponent(addrs)}¢er=lat,lng';
String appleUrl =
'https://maps.apple.com/?q=${addrs}&sll=lat,lng';
if (await canLaunch("comgooglemaps://")) {
print('launching com googleUrl');
await launch(googleUrl);
} else if (await canLaunch(appleUrl)) {
print('launching apple url');
await launch(appleUrl);
} else {
print('Could not launch url');
}```
Upvotes: 3
Views: 540
Reputation: 41
Please encode the URL for apple maps as you have done for google maps.
Upvotes: 2