onPlay property

AnimateCallback? onPlay
final

Called when the animation begins playing (ie. after Animate.delay, immediately after AnimationController.forward is called). Provides an opportunity to manipulate the AnimationController (ex. to loop, reverse, stop, etc).

For example, this would pause the animation at its start:

foo.animate(
  onPlay: (controller) => controller.stop()
).fadeIn()

This would loop the animation, reversing it on each loop:

foo.animate(
  onPlay: (controller) => controller.repeat(reverse: true)
).fadeIn()

Implementation

final AnimateCallback? onPlay;