Drives the animation from its current value to target.
Returns a Future that completes when the animation is complete.
Source
Future<Null> animateTo(double target, { Duration duration, Curve curve: Curves.linear }) { Duration simulationDuration = duration; if (simulationDuration == null) { assert(() { if (this.duration == null) { throw new 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; }); double range = upperBound - lowerBound; double remainingFraction = range.isFinite ? (target - _value).abs() / range : 1.0; simulationDuration = this.duration * remainingFraction; } stop(); if (simulationDuration == Duration.ZERO) { assert(value == target); _status = (_direction == _AnimationDirection.forward) ? AnimationStatus.completed : AnimationStatus.dismissed; _checkStatusChanged(); return new Future<Null>.value(); } assert(simulationDuration > Duration.ZERO); assert(!isAnimating); return _startSimulation(new _InterpolationSimulation(_value, target, simulationDuration, curve)); }