animateTo method
Drives the animation from its current value to the given target, "forward".
Returns a TickerFuture that completes when the animation is complete.
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.forward
regardless of whether target
> value or not. At the end of the
animation, when target
is reached, status is reported as
AnimationStatus.completed.
If the target
argument is the same as the current value of the
animation, then this won't animate, and the returned TickerFuture will
be already complete.
Implementation
TickerFuture animateTo(double target, { Duration? duration, Curve curve = Curves.linear }) {
assert(() {
if (this.duration == null && duration == null) {
throw FlutterError(
'AnimationController.animateTo() called with no explicit duration and no default duration.\n'
'Either the "duration" argument to the animateTo() method should be provided, or the '
'"duration" property should be set, either in the constructor or later, before '
'calling the animateTo() function.',
);
}
return true;
}());
assert(
_ticker != null,
'AnimationController.animateTo() called after AnimationController.dispose()\n'
'AnimationController methods should not be used after calling dispose.',
);
_direction = _AnimationDirection.forward;
return _animateToInternal(target, duration: duration, curve: curve);
}