0
 GoogleMap(
  padding: EdgeInsets.all(MySize.size50),
  trafficEnabled: Provider.of<TrackingNotifier>(context).showTraffic,
  polylines: gMapNotifier.sHomePolyline,
  polygons: Set.of(
      [if (gDeviceGeofences?.isNotEmpty ?? false) ...gDeviceGeofences]),
  markers: Set.of([
    if (gGeofenceMidMarkers != null) ...gGeofenceMidMarkers,
    ...liveDevicesMarkers,
  ]),
  initialCameraPosition: gMapNotifier.initialLocation,
  myLocationEnabled: true,
  myLocationButtonEnabled: false,
  mapType: tabProvider.mapType,
  zoomGesturesEnabled: true,
  zoomControlsEnabled: false,
  onMapCreated: (controller) {
    gMapNotifier.onMapCreated(controller);
  },
  onTap: (point) {
    //set polygon only when a vehicle selected
    //add fab button open dialog and choose vehical and add polygon using vehicle ID
    gMapNotifier.setPolygon(point);
  },
);


void onMapCreated(GoogleMapController controller) async {
mapController = controller;
try {
  if (cameraUpdate != null) {
    print('####### prev');
    await controller?.moveCamera(cameraUpdate);
  } else if (liveDevicesMarkers.length == 1) {
    print('####### next');

    await controller?.animateCamera(
      CameraUpdate.newCameraPosition(
        CameraPosition(
          target: LatLng(
            liveDevicesMarkers.elementAt(0).position.latitude,
            liveDevicesMarkers.elementAt(0).position.longitude,
          ),
          zoom: 18,
        ),
      ),
    );
  }
  // notifyListeners();
} catch (e) {
  print('Err home google map : ' + e.toString());
}

}

当我切换黑白两个谷歌地图标签时,它会给出这些错误

Err home google map : PlatformException(error, Error using newLatLngBounds(LatLngBounds, int): Map size can't be 0. 很可能,地图视图的布局尚未发生。要么等到布局发生,要么使用 newLatLngBounds(LatLngBounds , int, int, int) 允许您指定地图的尺寸​​。, null, com.google.maps.api.android.lib6.common.apiexception.c: Error using newLatLngBounds(LatLngBounds, int): Map size can' t 为 0。很可能,地图视图的布局尚未发生。要么等到布局发生,要么使用 newLatLngBounds(LatLngBounds, int, int, int) 来指定地图的尺寸​​。

超出 FrameTime I/chatty (1275) 中的样本计数:uid=11060(com.enbake.entracker) androidmapsapi-相同的 2 行

多次获得这个

MissingPluginException(在通道 plugins.flutter.io/google_maps_5 上找不到方法 polylines#update 的实现)

4

0 回答 0