reverse method
- double? from,
Starts running this animation in reverse (towards the beginning).
Returns a TickerFuture that completes when the animation is dismissed.
If from
is non-null, it will be set as the current value before running
the animation.
The most recently returned TickerFuture, if any, is marked as having been canceled, meaning the future never completes and its TickerFuture.orCancel derivative future completes with a TickerCanceled error.
During the animation, status is reported as AnimationStatus.reverse, which switches to AnimationStatus.dismissed when lowerBound is reached at the end of the animation.
Implementation
TickerFuture reverse({ double? from }) {
assert(() {
if (duration == null && reverseDuration == null) {
throw FlutterError(
'AnimationController.reverse() called with no default duration or reverseDuration.\n'
'The "duration" or "reverseDuration" property should be set, either in the constructor or later, before '
'calling the reverse() function.',
);
}
return true;
}());
assert(
_ticker != null,
'AnimationController.reverse() called after AnimationController.dispose()\n'
'AnimationController methods should not be used after calling dispose.',
);
_direction = _AnimationDirection.reverse;
if (from != null) {
value = from;
}
return _animateToInternal(lowerBound);
}