useJoltEffect top-level property
Creates a reactive effect hook that runs when dependencies change.
An effect is a side-effect function that automatically runs when any of its reactive dependencies change. Useful for logging, analytics, etc.
Parameters:
fn: The effect function to executelazy: Whether to defer running the effect on creation. Iftrue, the effect will NOT run immediately and will not track dependencies until you callrunon the returned effect. Iffalse(default), the effect runs immediately on creation and then re-runs whenever its reactive dependencies change.debug: Optional debug optionskeys: Optional keys for hook memoization
Returns: An Effect that tracks dependencies and runs automatically
Example:
Widget build(BuildContext context) {
final count = useSignal(0);
useJoltEffect(() {
print('Count changed to: ${count.value}');
});
return ElevatedButton(
onPressed: () => count.value++,
child: Text('Count: ${count.value}'),
);
}
Implementation
final useJoltEffect = JoltEffectHookCreator._();