watchEffect$ function
Sets up a reactive effect triggered by callback
and returns a function
to dispose of the effect when it’s no longer needed.
The $
suffix is used to indicate that this is a low-level function that
should be used with caution.
Implementation
VoidCallback watchEffect$(VoidCallback callback) {
final watcher = WatcherRaw<void>();
watcher.onChange = oneCallTask(watcher.run);
watcher.dryRun = callback;
watcher.onChange();
return watcher.dispose2;
}