【问题标题】:using flutter_polyline_points 0.2.4 not working but 0.1.0 works使用 flutter_polyline_points 0.2.4 不起作用,但 0.1.0 有效
【发布时间】:2020-12-14 13:27:59
【问题描述】:

我升级了我的 pub 文件并将我的 flutter_polyline_points 依赖项从 0.1.0 更新到 0.2.4 时出错,说此方法只接受 3 个参数并且正在使用 5 个。

List<PointLatLng> result = await polylinePoints?.getRouteBetweenCoordinates(
            googleAPIKey,
            sourceLocatioon.latitude,
            sourceLocatioon.longitude,
            destLocatioon.latitude,
            destLocatioon.longitude

        );

但它适用于flutter_polyline_points 0.1.0

【问题讨论】:

    标签: flutter google-maps dart


    【解决方案1】:

    在将 LatLng 值传递给 getRouteBetweenCoordinates() 方法时使用 PointLatLng()。例如:

    List<PointLatLng> result = await polylinePoints?.getRouteBetweenCoordinates(
       googleAPIKey,
       PointLatLng(sourceLocatioon.latitude, sourceLocatioon.longitude),
       PointLatLng(destLocatioon.latitude, destLocatioon.longitude)
    );
    

    flutter_polyline_points: 0.2.4 包中包含新的PointLatLng 方法,用于传入起点和终点坐标。查看包装样本here.

    【讨论】:

    • 感谢包样本也有帮助
    • 很高兴有帮助!
    猜你喜欢
    • 2012-09-30
    • 2010-11-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多