listenSignal method
Watch signal value
Implementation
void listenSignal(
ReadonlySignal<dynamic> target,
void Function() callback, {
String? debugLabel,
}) {
final current = _signals[target.globalId];
if (current?.listener?.cb.hashCode == callback.hashCode) return;
current?.listener?.cleanup();
final cb = createEffect(
callback,
debugLabel: debugLabel,
);
_signals[target.globalId] = (
local: current?.local,
target: target,
listener: (cb: callback, cleanup: cb),
);
}