addEffect method

void addEffect(
  1. void effectCb(), {
  2. String? debugLabel,
})

Registers an effectCb that will automatically be disposed when this controller is disposed.

Parameters:

  • effectCb: The reactive callback to execute whenever its read signals change.
  • debugLabel: Optional debugging label for DevTools inspection.

Implementation

void addEffect(void Function() effectCb, {String? debugLabel}) {
  if (_isDisposed) return;
  final dispose = effect(effectCb, debugLabel: debugLabel ?? '$runtimeType.effect');
  _disposers.add(dispose);
}