zoomLevel property

double get zoomLevel

Current zoom level of the map layer.

Defaults to 1.

The default zoomLevel value is 1 which will show the whole map in the viewport for MapShapeLayer and the available bounds for the MapTileLayer based on the focalLatLng (Please check the documentation of MapTileLayer to know more details about how zoomLevel works in it).

You can also get the current zoom level after interaction using the zoomLevel property.

Implementation

double get zoomLevel => _zoomLevel;
set zoomLevel (double value)

Implementation

set zoomLevel(double value) {
  assert(value >= kDefaultMinZoomLevel);
  assert(value >= minZoomLevel && value <= maxZoomLevel);
  if (_zoomLevel == value || value < minZoomLevel || value > maxZoomLevel) {
    return;
  }

  _zoomLevel = value;
  if (_controller != null && _controller!.layerType == LayerType.shape) {
    _controller!.onZoomLevelChange(value);
    return;
  }

  if (_zoomController!.parentRect != null) {
    _zoomController!.zoomLevel = value;
    // Intimating the zoom controller to update the actual rect based on the
    // new zoom level. This gets works only when there is simultaneous
    // zoom pan property changes has been performed.
    _updateZoomControllerActualRect();
  }
  return;
}