首页 > 解决方案 > 如何在 Flutter 的地图上绘制从源到目的地的路径?

问题描述

如何在颤动图中绘制路径并显示方向。我正在使用 google_map_flutter API,但我没有找到任何可能的方法来绘制路径。

我也尝试了 map_view 插件,但无法获得可能的解决方案

 GoogleMap(
       markers: _markers,
       mapType: MapType.normal,
       initialCameraPosition: CameraPosition(
           target: latLng,
            zoom: 14.4746,
       ),
        onMapCreated: (GoogleMapController controller) {
          _controller.complete(controller);
        },
   ),
  floatingActionButton: FloatingActionButton.extended(
    onPressed: _goToTheLake,
    label: Text('To the lake!'),
    icon: Icon(Icons.directions_boat),
  ),

    Future<void> _goToTheLake() async {
    final GoogleMapController controller = await _controller.future;
       controller.animateCamera(CameraUpdate.newLatLng( LatLng(20.008751, 
        73.780037)));
       }

标签: androidgoogle-mapsflutterdartlocation

解决方案


推荐阅读