[英]Flutter Google maps polylines from current location to another location
I am trying to draw polyline from my current location to another location in flutter, all the examples I have seen online doesn't have a problem with this part of the code.我正在尝试将折线从我当前的位置绘制到颤振中的另一个位置,我在网上看到的所有示例都没有这部分代码的问题。
void setPolylines() async {
List<PointLatLng> result = await polylinePoints.getRouteBetweenCoordinates(
googleAPIKey,
currentLocation.latitude,
currentLocation.longitude,
destinationLocation.latitude,
destinationLocation.longitude);
This code above is giving me the error below上面的这段代码给了我下面的错误
A value of type 'PolylineResult' can't be assigned to a variable of type 'List<PointLatLng>'.
Try changing the type of the variable, or casting the right-hand type to 'List<PointLatLng>'.
Open documentation
Too many positional arguments: 3 expected, but 5 found. Try removing the extra positional arguments, or specifying the name for named arguments. Open documentation
It looks like you are using flutter_polyline_points package based on the method you used.看起来您正在根据您使用的方法使用flutter_polyline_points包。
Looking at the documentation, it appears that you need to pass the result of getRouteBetweenCoordinates
method to PolylineResult
instead of List<PointLatLng>
查看文档,您似乎需要将
getRouteBetweenCoordinates
方法的结果传递给PolylineResult
而不是List<PointLatLng>
For example:例如:
PolylineResult result = await polylinePoints.getRouteBetweenCoordinates(googleAPiKey,
_originLatitude, _originLongitude, _destLatitude, _destLongitude);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.