I've been working with flutter_maps and encountering this frustrating straight line bug, im using osm for polypoints then compiling it to make a polylines it works but the problem is there is this straight line from point a to point b.
anyone encounter and fix it?
CodePudding user response:
I think you should have to use the URL Launcher https://pub.dev/packages/url_launcher .Because it is not a lengthy process and easily launches Google Maps as compared to creating the widget of Google Maps and creating all the things like polylines and markers etc. Here is a simple function that will be very helpful for you, You should have to pass only the latitude and longitude:
static Future<void> showGoogleMapByURL(
double latitude, double longitude) async {
String googleMapUrl =
'https://www.google.com/maps/search/?api=1&query=$latitude,$longitude';
if (await canLaunchUrlString(googleMapUrl)) {
await launchUrlString(googleMapUrl);
} else {
throw ('Could not open the map ');
}
}