updateClusters method

Future<void> updateClusters({
  1. required double zoomLevel,
})

Updates the clusters based on the current zoomLevel.

Implementation

Future<void> updateClusters({required double zoomLevel}) async {
  // Ensure the zoom level does not go below the minimum threshold
  if (zoomLevel < _minZoomLevel) {
    zoomLevel = _minZoomLevel;
  }
  double radius = _getRadiusForZoomLevel(zoomLevel);

  if (radius == 0.0) {
    _clusteredMarkers = _markers;
    return;
  }

  _clusteredMarkers = await _createClusters(_markers, radius);
}