EffectScopeImpl class
Implementation of EffectScope for managing the lifecycle of effects and other reactive nodes.
This is the concrete implementation of the EffectScope interface. 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.
See EffectScope for the public interface and usage examples.
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
-
- Object
- ReactiveNode
- EffectScopeReactiveNode
- EffectScopeImpl
- Implemented types
- Mixed-in types
- Implementers
Constructors
- EffectScopeImpl({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
-
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 node and cleans up 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 during the disposal process to perform custom cleanup.
override
-
run<
T> (T fn()) → T -
Runs a function within this scope's context.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited