flush function
void
flush()
Flushes all queued effects, executing them in order.
Processes the queue of effects that have been notified of changes, running each effect function and clearing the queue. This ensures all side effects are synchronized with the current reactive state.
Called automatically when a batch completes or can be called manually to force immediate effect execution.
Implementation
@pragma('vm:align-loops')
@pragma('vm:prefer-inline')
@pragma('dart2js:tryInline')
@pragma('wasm:prefer-inline')
void flush() {
while (queuedEffects != null) {
final effect = queuedEffects as EffectNode;
if ((queuedEffects = effect.nextEffect) != null) {
effect.nextEffect = null;
} else {
queuedEffectsTail = null;
}
run(effect);
}
}