Given lat and long. Is there any fast/smart way to open maps google/apple in Flutter and head to directions ?
I'm using url_launcher for telephone calls, can i use the plugin to open link that open maps ?
_launchURL() async {
const url = 'https://www.google.com/maps/place/Al+qi,+ADoqi,+Giza+Governorate/@33.0523046,38.2009323,17z/data=!3m1!4b1!4m5!3m4!1s0x1458413a996ec217:0x2411f6b62d93ccc!8m2!3d30.05237!4d31.2031598';
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
To show the location popup within the app, you can use location package in your Project. Add this package by adding the following lines in your pubspec. yaml file. This code will show the following alert dialog within App.
Yes you can do that using the url_launcher
plugin. The following code will open Google Maps when the app is installed on the phone (otherwise it will open the browser):
void _launchMapsUrl(double lat, double lon) async {
final url = 'https://www.google.com/maps/search/?api=1&query=$lat,$lon';
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With