Redirect to google maps app with directions between source and destination with some stops in flutter

此生再无相见时 提交于 2021-01-29 08:46:11

问题


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

  1. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!