flutter - Flutter Google 将折线从当前位置映射到另一个位置
问题描述
我正在尝试将折线从当前位置绘制到颤动的另一个位置,我在网上看到的所有示例都没有这部分代码的问题。
void setPolylines() async {
List<PointLatLng> result = await polylinePoints.getRouteBetweenCoordinates(
googleAPIKey,
currentLocation.latitude,
currentLocation.longitude,
destinationLocation.latitude,
destinationLocation.longitude);
上面的代码给了我下面的错误
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
解决方案
看起来您正在使用基于您使用的方法的flutter_polyline_points包。
查看文档,您似乎需要将getRouteBetweenCoordinates
方法的结果传递给PolylineResult
而不是List<PointLatLng>
例如:
PolylineResult result = await polylinePoints.getRouteBetweenCoordinates(googleAPiKey,
_originLatitude, _originLongitude, _destLatitude, _destLongitude);
推荐阅读
- google-cloud-platform - 我可以在单个策略中授予服务帐户对多个存储桶的访问权限吗?
- python - 如何更改此代码上呈现的数字
- python - 我正在尝试使用 Python 和 Outlook 发送邮件,但在 mail.Send() 处出现错误
- c - Windows / msvc 上的叮当声:为什么在 FE_UPWARD printf("%.1f\n", 0.0) 下打印 0.1 而不是 0.0?
- android - 如何处理范围存储的向后兼容性?
- apache-spark - 使用 podTemplate 将 configMap 挂载到 spark 驱动程序
- java - 如何让java命令运行?
- javascript - 从 HTML DOM 元素中获取切换组件的值
- ios - ios上的Flutter NFC Manager问题
- python - 基于多个条件的新熊猫列