animateTo method
Implementation
void animateTo(
double target, {
SpringMotionPreset? preset,
bool reducedMotion = false,
}) {
if (!target.isFinite) {
throw ArgumentError.value(target, 'target', 'must be finite');
}
if (reducedMotion) {
jumpTo(target);
return;
}
final simulation = SpringSimulation(
springDescriptionFor(preset ?? this.preset),
_controller.value,
target,
_controller.velocity,
);
_controller.animateWith(simulation).whenCompleteOrCancel(() {
if (!_disposed) _controller.value = target;
});
}