mirror method

TickerFuture mirror({
  1. Duration? duration,
})

Starts playing the animation in an endless loop. After reaching the end, it plays it backwards, then forward and so on.

If a duration named parameter is provided it will be applied as the AnimationController.duration value. The duration applies to the length of one loop iteration.

Returns a TickerFuture that only completes when the animation gets canceled.

Example: (using supercharged)

controller.mirror(5.seconds);

Implementation

TickerFuture mirror({Duration? duration}) {
  this.duration = duration ?? this.duration;
  return repeat(reverse: true);
}