isTicking property Null safety

bool isTicking

Whether this Ticker has scheduled a call to call its callback on the next frame.

A ticker that is muted can be active (see isActive) yet not be ticking. In that case, the ticker will not call its callback, and isTicking will be false, but time will still be progressing.

This will return false if the SchedulerBinding.lifecycleState is one that indicates the application is not currently visible (e.g. if the device's screen is turned off).


bool get isTicking {
  if (_future == null)
    return false;
  if (muted)
    return false;
  if (SchedulerBinding.instance!.framesEnabled)
    return true;
  if (SchedulerBinding.instance!.schedulerPhase != SchedulerPhase.idle)
    return true; // for example, we might be in a warm-up frame or forced frame
  return false;