EffectScope class

A scope for managing the lifecycle of effects and other reactive nodes.

EffectScope allows you to group related effects together and dispose them all at once. It's useful for component-based architectures where you want to clean up all effects when a component is destroyed.

Example:

final scope = EffectScope()
  ..run(() {
    final signal = Signal(0);
    Effect(() => print('Value: ${signal.value}'));

    // Both signal and effect will be disposed when scope is disposed
  });

// Later, dispose all effects in the scope
scope.dispose();
Inheritance

Constructors

EffectScope({bool? detach, JoltDebugFn? onDebug})
Creates a new effect scope.

Properties

deps Link?
First dependency link in the chain.
getter/setter pairinherited
depsTail Link?
Last dependency link in the chain.
getter/setter pairinherited
flags int
Reactive flags for this node.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
isDisposed bool
Whether this effect has been disposed.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subs Link?
First subscriber link in the chain.
getter/setter pairinherited
subsTail Link?
Last subscriber link in the chain.
getter/setter pairinherited

Methods

dispose() → void
Disposes this effect and cleans up all resources.
inherited
doCleanup() → void
Executes all registered cleanup functions and clears the cleanup list.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onCleanUp(Disposer fn) → void
Registers a cleanup function to be called when this effect is disposed or re-run.
inherited
onDispose() → void
Called when this effect is being disposed.
inherited
run<T>(T fn()) → T
Runs a function within this scope's context.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited