run static method

void run(
  1. VoidCallback action
)

Runs the given function within an action context.

All changes inside this function are considered part of a single action. Reactions will be deferred and then flushed after execution.

Implementation

static void run(VoidCallback action) {
  _isInAction = true;
  try {
    action();
  } finally {
    _isInAction = false;
    while (_queue.isNotEmpty) {
      _queue.removeFirst()();
    }
  }
}