animateWith method Null safety

TickerFuture animateWith(
  1. Simulation simulation
)

Drives the animation according to the given simulation.

The values from the simulation are clamped to the lowerBound and upperBound. To avoid this, consider creating the AnimationController using the AnimationController.unbounded constructor.

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.

The status is always AnimationStatus.forward for the entire duration of the simulation.

Implementation

TickerFuture animateWith(Simulation simulation) {
  assert(
    _ticker != null,
    'AnimationController.animateWith() called after AnimationController.dispose()\n'
    'AnimationController methods should not be used after calling dispose.',
  );
  stop();
  _direction = _AnimationDirection.forward;
  return _startSimulation(simulation);
}