onActiveChanged method Null safety

void onActiveChanged()

Perform tasks when the animation's active state changes

Implementation

void onActiveChanged() {
  // If the animation stops and it is at the end of the one-shot, reset the
  // animation back to the starting time
  if (!isActive) {
    reset();
  }
  // Fire any callbacks
  isActive
      ? onStart?.call()
      // onStop can fire while widgets are still drawing
      : WidgetsBinding.instance?.addPostFrameCallback((_) => onStop?.call());
}