stop method

void stop({
  1. bool canceled = false,
})

Stops the animation at its current value.

After calling stop, processTick becomes a no-op and the next AnimationTickMsg will not schedule another tick — the animation self-terminates.

If canceled is false (the default), the status is set to AnimationStatus.completed or AnimationStatus.dismissed depending on the current value. If canceled is true the status is set based on the most recent direction.

Implementation

void stop({bool canceled = false}) {
  if (!isAnimating) return;
  _repeating = false;
  if (canceled) {
    _status = _status == AnimationStatus.forward
        ? AnimationStatus.dismissed
        : AnimationStatus.completed;
  } else {
    _status = _value >= upperBound
        ? AnimationStatus.completed
        : AnimationStatus.dismissed;
  }
  _notifyStatusListeners();
}