Home > Software engineering >  Google map in flutter application
Google map in flutter application

Time:12-15

Can we implement google maps in a flutter application which runs once and fetches route from location1 to location2 and then we can move over the route without placing any new request to google API console?

Like, for the hikers and travelers who is supposed to be in a part where they may not have internet access then can user offline routes saved on device.

Thanks

I have tried google console APIs but it requires timely requests and costs a lot.

CodePudding user response:

In my case, I use Flutter Map with Google Map Tile layer. When performing routing, API server sends me a list of Coordinates that make up a path from start to end. Then I just add them to Polyline layer to display on the map.

CodePudding user response:

yes, you can do it. You have to hit the direction API to get the direction from point A to Point B. In JSON response you will get all the required data, like polyline points, steps, routes, and Lat, Lng. Save the polyLine points and draw polylines on GoogleMaps. And when you move, simply get your latLng from GPS using a geolocator or Location package and set a listener on it for every movement. And now it will work without the internet. But for another request, you will need internet.

  • Related