首页 > 解决方案 > error: The method 'setMapStyle' isn't defined for the type 'Completer'

问题描述

enter image description here

I'm getting this error when I'm trying to change ma Google maps Color

error: The method 'setMapStyle' isn't defined for the type 'Completer'.

标签: androidflutter

解决方案


首先定义ControllerGoogleMap

  GoogleMapController mapController;

现在添加它Controller以在您的 GoogleMap 小部件中设置地图的地图样式。

  onMapCreated: (GoogleMapController controller) {
    mapController = controller;
    mapController.setMapStyle(mapStyle);
    // _controller.complete(controller);
  },

推荐阅读