animateCamera method

Future<void> animateCamera(
  1. CameraUpdate cameraUpdate, {
  2. Duration? duration,
  3. AnimationFinishedCallback? onFinished,
})

Animates the movement of the camera from the current position to the position defined in the cameraUpdate.

See CameraUpdate for more information on how to create different camera animations.

On Android you can override the default animation duration and set onFinished callback that is called when the animation completes (passes true) or is cancelled (passes false).

Example usage:

controller.animateCamera(CameraUpdate.zoomIn(),
  duration: Duration(milliseconds: 600),
  onFinished: (bool success) => {});

On iOS duration and onFinished are not supported and defining them does nothing.

See also moveCamera, followMyLocation, showRouteOverview.

Implementation

Future<void> animateCamera(CameraUpdate cameraUpdate,
    {Duration? duration, AnimationFinishedCallback? onFinished}) {
  return GoogleMapsNavigationPlatform.instance.animateCamera(
      viewId: _viewId,
      cameraUpdate: cameraUpdate,
      duration: duration?.inMilliseconds,
      onFinished: onFinished);
}