RepeatAdapter class

Repeats an animation with timer-based pauses between runs.

Unlike an effect delay, pause is outside the controller timeline, so the controller does not tick while waiting. Remove the effect's delay when moving that wait here. Use initialDelay for the wait before the first run; Animate.delay and Animate.autoPlay do not control adapters.

Each direction counts as one run. With reverse and count: 2, the animation runs forward once, waits, then reverses once. count defaults to infinite; zero leaves the animation at zero without starting it. Pauses hold the value reached by the previous run.

period is the duration of each run, or the controller's duration when null. It must be positive. pause and initialDelay must be nonnegative. Pauses use wall-clock timers and are not scaled by Flutter's time dilation.

Keep the adapter instance across rebuilds to preserve playback. Replacing it restarts the sequence. While attached, the adapter controls playback; do not also set Animate.target / Animate.value or drive its controller directly. It never disposes the controller or changes its duration. Detaching cancels pending waits and stops a run that this adapter started.

Animate.onComplete fires normally when a forward run reaches one. Animate.onPlay is not called for adapter-driven playback.

final repeat = RepeatAdapter(pause: const Duration(seconds: 2));
// Within build:
// child.animate(adapter: repeat).shimmer(duration: const Duration(seconds: 1));
Inheritance

Constructors

RepeatAdapter({required Duration pause, Duration initialDelay = Duration.zero, Duration? period, bool reverse = false, int? count})

Properties

animated bool
finalinherited
count int?
Number of one-direction runs; null repeats indefinitely.
final
direction Direction?
finalinherited
hashCode int
The hash code for this object.
no setterinherited
initialDelay Duration
Idle time before the first run, holding zero.
final
pause Duration
Idle time between runs, holding the previous endpoint.
final
period Duration?
Duration of each run, defaulting to the controller's duration.
final
reverse bool
Whether successive runs alternate forward and reverse.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

attach(AnimationController controller) → void
override
config(AnimationController controller, double value, {ChangeNotifier? notifier, VoidCallback? listener}) → void
inherited
detach() → void
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
updateValue(double value) → void
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited