0

I am trying to find what link I can place in my code that will allow me to automatically open google maps and starts a path to my adress, right now I have this:

  Future<void> _openMapsWithDirection(String adress) async {
    final uri =
        Uri.parse("https://www.google.com/maps/search/?api=1&query=$adress");
    if (await canLaunchUrl(uri)) {
      await launchUrl(uri);
    } else {
      throw 'Could not launch $uri';
    }
  }

this code allows me to open google maps with my desire adress, but I need to press "start" in order to app start to work, I know that there must be a link that will tell google maps to start this path from my current location to desire adress, but I do not know where to even search it.

I am using url_launcher package, there is a option to use maps_launcher, but I did everythink on url_launcher, and I want at least try this way.

I found this page: https://developers.google.com/maps/documentation/urls/get-started.

Where is for example "https://www.google.com/maps/dir/?api=1&origin=Google+Pyrmont+NSW&destination=QVB&destination_place_id=ChIJISz8NjyuEmsRFTQ9Iw7Ear8&travelmode=walking", and this allows me to go from a place to my adress, but how I can get my CURRENT location?

Maciek
  • 181
  • 3
  • 12

1 Answers1

0

I found solution in here: Current Location - Google Maps - Link to Directions

the solution link is "https://www.google.com/maps/dir/Current+Location/$adress"

Maciek
  • 181
  • 3
  • 12