centerOnPoints method

  1. @Deprecated('Prefer `animatedFitCamera` with a `CameraFit.coordiantes() or CameraFit.bounds()` instead. ' 'This method will be removed in a future release as it is now redundant. ' 'This method is deprecated since v0.5.0')
Future<void> centerOnPoints(
  1. List<LatLng> points, {
  2. Curve? curve,
  3. String? customId,
})

Will use the LatLngBounds.fromPoints method to calculate the bounds of the points and then use the animatedFitCamera method to animate to that position.

If curve is not specified, the one specified in the constructor will be used.

Implementation

@Deprecated(
  'Prefer `animatedFitCamera` with a `CameraFit.coordiantes() or CameraFit.bounds()` instead. '
  'This method will be removed in a future release as it is now redundant. '
  'This method is deprecated since v0.5.0',
)
Future<void> centerOnPoints(
  List<LatLng> points, {
  Curve? curve,
  String? customId,
}) {
  final cameraFit = CameraFit.bounds(
    bounds: LatLngBounds.fromPoints(points),
    padding: const EdgeInsets.all(12),
  );

  return animatedFitCamera(
    cameraFit: cameraFit,
    curve: curve,
    customId: customId,
  );
}