run method

  1. @override
void run()
override

Manually runs the effect function.

This establishes the effect as the current reactive context, allowing it to track dependencies accessed during execution.

Example:

final effect = Effect(() => print('Hello'), lazy: false);
effect.run(); // Prints: "Hello"

Implementation

@override
void run() {
  assert(!isDisposed, "Watcher is disposed");
  flags |= ReactiveFlags.dirty;
  runEffect();
}