ResilientAnimationController constructor

ResilientAnimationController({
  1. bool broadcast = false,
  2. double? value,
  3. Duration? duration,
  4. Duration? reverseDuration,
  5. String? debugLabel,
  6. double lowerBound = 0.0,
  7. double upperBound = 1.0,
  8. AnimationBehavior animationBehavior = AnimationBehavior.normal,
  9. required TickerProvider vsync,
})

Creates a resilient animation controller with bounded limits.

  • broadcast: Whether to broadcast updates to multiple subscribers. Defaults to false.
  • value: The initial value of the animation. Defaults to lowerBound.
  • duration: The length of time this animation should last.
  • reverseDuration: The length of time this animation should last when going in reverse.
  • debugLabel: A label used to identify this animation in debug output.
  • lowerBound: The minimum value for this animation. Defaults to 0.0.
  • upperBound: The maximum value for this animation. Defaults to 1.0.
  • animationBehavior: The behavior when animations are disabled by system settings. Defaults to AnimationBehavior.normal.
  • vsync: The TickerProvider for driving the animation ticker.

Requires:

  • upperBound must be greater than or equal to lowerBound.

Ensures:

  • Initializes in a dormant state (_DormantAnimationControlDelegate) until the coral resource is activated.

Example:

final controller = ResilientAnimationController(
  duration: const Duration(milliseconds: 300),
  vsync: vsyncProvider,
);

Implementation

ResilientAnimationController({
  this.broadcast = false,
  double? value,
  Duration? duration,
  Duration? reverseDuration,
  this.debugLabel,
  this.lowerBound = 0.0,
  this.upperBound = 1.0,
  this.animationBehavior = AnimationBehavior.normal,
  required this.vsync,
}) : assert(upperBound >= lowerBound) {
  assert(debugMaybeDispatchCreated('animation', 'AnimationController', this));
  _delegate = _DormantAnimationControlDelegate(
    value: value ?? lowerBound,
    duration: duration,
    reverseDuration: reverseDuration,
    lowerBound: lowerBound,
    upperBound: upperBound,
    onValueOrDurationChanged: notifyListeners,
  );
}