hasRunningAnimations property
Whether there are any transient callbacks scheduled.
This essentially checks whether all animations have completed.
See also:
- pumpAndSettle, which essentially calls pump until there are no scheduled frames.
- SchedulerBinding.transientCallbackCount, which is the value on which this is based.
- SchedulerBinding.hasScheduledFrame, which is true whenever a frame is pending. SchedulerBinding.hasScheduledFrame is a necessary (but not sufficient) condition to hasRunningAnimations, as new frames can be scheduled when widget calls State.setState, even if there are no transient callbacks scheduled. This is what pumpAndSettle uses.
Implementation
bool get hasRunningAnimations => binding.hasScheduledFrame && binding.transientCallbackCount > 0;