repeat method

TickerFuture repeat ({double min, double max, bool reverse: false, Duration period })

Starts running this animation in the forward direction, and restarts the animation when it completes.

Defaults to repeating between the lowerBound and upperBound of the AnimationController when no explicit value is set for min and max.

With reverse set to true, instead of always starting over at min the value will alternate between min and max values on each repeat.

Returns a TickerFuture that never completes. The TickerFuture.orCancel future completes with an error when the animation is stopped (e.g. with stop).

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.


TickerFuture repeat({ double min, double max, bool reverse = false, Duration period }) {
  min ??= lowerBound;
  max ??= upperBound;
  period ??= duration;
  assert(() {
    if (period == null) {
      throw FlutterError(
        'AnimationController.repeat() called without an explicit period and with no default Duration.\n'
        'Either the "period" argument to the repeat() method should be provided, or the '
        '"duration" property should be set, either in the constructor or later, before '
        'calling the repeat() function.'
    return true;
  assert(max >= min);
  assert(max <= upperBound && min >= lowerBound);
  assert(reverse != null);
  return animateWith(_RepeatingSimulation(_value, min, max, reverse, period));