fitBounds method

void fitBounds(
  1. dynamic bounds, [
  2. FitBoundsOptions? options
])

Implementation

void fitBounds(dynamic bounds, [FitBoundsOptions? options]) {
  log('MapStates fitBounds');

  LatLngBounds latlngBounds = LatLngBounds.from(bounds);

  if (latlngBounds.isNotValid) {
    throw Exception('Bounds are not valid');
  }

  final target =
      _getBoundsCenterZoom(latlngBounds, options ?? const FitBoundsOptions());

  move(target.center, target.zoom, true);
}