useEffectScope top-level property
Creates an effect scope hook for managing effect lifecycles.
An effect scope allows you to group related effects together and dispose them all at once. Useful for component-based architectures.
Parameters:
fn: Optional function to execute within the scope contextkeys: Optional keys for hook memoizationdebug: Optional debug options
Returns: An EffectScope for managing effect lifecycles
Example:
Widget build(BuildContext context) {
useEffectScope(fn: (scope) {
scope.run(() {
final signal = Signal(0);
Effect(() => print(signal.value));
onScopeDispose(() => print('Scope cleaned up'));
});
});
return Text('Component with scoped effects');
}
Implementation
final useEffectScope = JoltEffectScopeHookCreator._();