我想重定向到设备默认的谷歌地图应用程序。所以我使用一些参数调用波纹管 url,但优化参数不起作用。所以,任何人都知道如何在启动谷歌地图网址时应用优化真或假。
这是输出网址。
String mapOptions = [
'origin=${widget.currentLocation.latitude.toString()}%2C${widget.currentLocation.longitude.toString()}',
'destination=${(destinationAddress.replaceAll(',', '%2C')).replaceAll(' ', '%20')}',
'destination_place_id=${widget.routeDeliveryDetail.deliveryList[widget.routeDeliveryDetail.deliveryList.length - 1].placeId}',
'waypoints=$wayPoint',
'waypoint_place_ids=$wayPointPLaceId',
'optimization=true',
'travelmode=driving'
].join('&');
String googleUrl = 'https://www.google.com/maps/dir/?api=1&$mapOptions';
print(googleUrl);
try {
if (await canLaunch(googleUrl)) {
await launch(googleUrl);
} else {
throw 'Could not open the map.';
}
} catch (e) {
print(e);
}