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

2,281

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);
Share:
2,281
Code Runner
Author by

Code Runner

I am software developer in C# with more than 2 years experience and right now i working as mobile developer with xamarin in Ontario,Canada.

Updated on December 15, 2022

Comments

  • Code Runner
    Code Runner over 1 year

    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?