fitBounds method

  1. @override
void fitBounds(
  1. List<LatLng> points
)
override

Moves the camera to fit points.

Implementations whose provider reports no reason for a camera change should mix in MapMoveAttribution and call beginProgrammaticMove() immediately before the platform call, so the move it produces is not reported to the host as a user gesture. See MapMoveSource.

Implementation

@override
void fitBounds(List<LatLng> points) {
  if (points.length < 2) {
    return;
  }
  mapController.animatedFitCamera(
    cameraFit: CameraFit.coordinates(
      coordinates: points,
      padding: padding ?? const EdgeInsets.all(0),
      maxZoom: 18.0,
    ),
  );
}