TickerSignal constructor

TickerSignal({
  1. Duration? initialDuration,
  2. String? debugLabel,
})

Ticker signal used to drive animations and can create animation controllers

void main() {
  final ticker = TickerSignal(); // could be a global
  final controller = ticker.toAnimationController(); // can be local or global
  final curve = CurvedAnimation(parent: controller, curve: Curves.easeOut); // can be used outside of widget tree
  final alpha = IntTween(begin: 0, end: 255).animate(curve);
  ...
  final alphaSignal = alpha.toSignal(); // can be converted to a signal
}

Implementation

TickerSignal({
  Duration? initialDuration,
  super.debugLabel,
}) : super(initialDuration ?? Duration.zero) {
  initSchedulerBindingSignals(); // no-op if already called
  _cleanup = effect(() {
    super.value = onPersistentFrameSignal();
  });
}