问题
I want to redirect to google maps app for navigation with some stops between source and destination from my flutter application. url_launcher package redirects to map with source and destination but I want with some stops. Is that possible?
回答1:
If you want to navigate with directions you can just create a url with source and destination co-ordinates and other coordinates to add as stops.
Steps: 1. Install url_launcher plugin
- write a code like below.
_launchURL(String url) async {
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
const url ='https://www.google.com/maps/dir/?api=1&origin=43.7967876,-79.5331616&destination=43.5184049,-79.8473993&waypoints=43.1941283,-79.59179|43.7991083,-79.5339667|43.8387033,-79.3453417|43.836424,-79.3024487&travelmode=driving&dir_action=navigate';
_launchURL(url);
来源:https://stackoverflow.com/questions/59140865/redirect-to-google-maps-app-with-directions-between-source-and-destination-with