moveTo method

void moveTo(
  1. ViewportState state, {
  2. ViewportTransition? transition = const DefaultViewportTransition(),
  3. void completion(
    1. bool
    )?,
})

Animates the map camera to the given state.

If a previous animation is still in progress, its completion callback is called with false before the new animation starts.

transition controls the animation style. Defaults to DefaultViewportTransition. Pass null to jump to the new state without animation.

completion is called when the animation finishes. The boolean parameter is true if the animation completed normally, false if it was cancelled (e.g., by another moveTo call or user interaction).

Implementation

void moveTo(
  ViewportState state, {
  ViewportTransition? transition = const DefaultViewportTransition(),
  void Function(bool)? completion,
}) {
  _pendingCompletion?.call(false);
  _state = state;
  _pendingTransition = transition;
  _pendingCompletion = completion;
  notifyListeners();
}