resume method

  1. @override
void resume([
  1. bool tryRun = false
])
override

Resumes the watcher, re-enabling it to respond to changes.

When resumed, the watcher will:

  • Re-collect dependencies by tracking the watched sources
  • Start responding to changes in watched sources again

Parameters:

  • tryRun: If true, attempts to run the watcher immediately after re-collecting dependencies. If false, only re-collects dependencies without executing the callback.

Example:

final watcher = Watcher(...);
watcher.pause();

// Resume without executing
watcher.resume();

// Resume and try to run immediately
watcher.resume(tryRun: true);

Implementation

@override
void resume([bool tryRun = false]) {
  assert(!isDisposed, "Watcher is disposed");
  _isPaused = false;

  if (!tryRun) {
    trackWithEffect(sourcesFn, this);
  } else {
    trackWithEffect(_effectFn, this);
  }
}