Code Runner
Code Runner

Reputation: 1028

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

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?

Upvotes: 1

Views: 4741

Answers (1)

Code Runner
Code Runner

Reputation: 1028

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);

Upvotes: 9

Related Questions