setup library

Setup Widget - A composition-based API for Flutter widgets.

This library provides SetupWidget, a widget system similar to Vue's Composition API, where the setup function executes only once when the widget is created. It includes hooks for reactive state management and lifecycle callbacks.

Classes

AutoDisposeHook<T extends Disposable>
Creates a stream hook from a reactive node. A hook implementation that manages disposable Jolt reactive nodes.
DisposableHook<T>
A hook that memoizes a value and optionally calls a disposer on unmount.
JoltEffectHookCreator
Helper class for creating effect hooks in SetupWidget.
JoltEffectScopeHookCreator
JoltSetupContext<T extends SetupWidget<T>>
The setup context that manages hooks and reactive state for a SetupWidget.
JoltSignalHookCreator
Helper class for creating signal hooks in SetupWidget.
JoltUseComputed
Helper class for creating computed hooks in SetupWidget.
JoltWatcherHookCreator
Helper class for creating watcher hooks in SetupWidget.
PropsReadonlyNode<T extends SetupWidget<T>>
A reactive node that tracks widget property changes.
SetupBuildContext<T extends SetupWidget<T>>
The build context for SetupWidget that provides access to widget properties.
SetupBuilder
A convenience widget that uses a builder function for setup.
SetupHook<T>
Base class for all setup hooks.
SetupWidget<T extends SetupWidget<T>>
A widget that uses a composition-based API similar to Vue's Composition API.
SetupWidgetElement<T extends SetupWidget<T>>
The Element that manages the lifecycle of a SetupWidget.

Properties

useComputed → _JoltUseComputedImpl
Creates a computed value hook that derives from reactive dependencies.
final
useEffect → _JoltEffectHookCreatorImpl
Creates an effect hook that runs in response to reactive dependencies.
final
useEffectScope → _JoltEffectScopeHookCreatorImpl
Creates an effect scope hook for managing groups of effects.
final
useSignal → _JoltSignalHookCreatorImpl
Creates a reactive signal hook with an initial value.
final
useWatcher → _JoltWatcherHookCreatorImpl
Creates a watcher hook that observes specific reactive sources.
final

Functions

onActivated(void callback()) → void
Registers a callback to run when the widget is reactivated.
onDeactivated(void callback()) → void
Registers a callback to run when the widget is deactivated.
onDidChangeDependencies(void callback()) → void
Registers a callback to run when the widget's dependencies change.
onDidUpdateWidget(void callback()) → void
Registers a callback to run when the widget is updated with new properties.
onMounted(void callback()) → void
Registers a callback to run when the widget is mounted.
onUnmounted(void callback()) → void
Registers a callback to run when the widget is unmounted.
useAutoDispose<T extends Disposable>(T creator()) → T
Creates a hook that automatically disposes a disposable resource.
useContext() BuildContext
Gets the current BuildContext from the SetupWidget.
useHook<T>(SetupHook<T> hook) → T
Creates a hook that persists across rebuilds and hot reloads.
useMemoized<T>(T creator(), [void disposer(T state)?]) → T
Memoizes a value and optionally calls a disposer when unmounted.
useSetupContext() JoltSetupContext<SetupWidget>
Gets the current JoltSetupContext.
useStream<T>(ReadonlyNode<T> value) Stream<T>
Creates a stream hook from a reactive value.

Typedefs

SetupFunction<T> = Widget Function()
A function type that builds a widget.
SetupFunctionBuilder<T extends SetupWidget<T>> = SetupFunction<T> Function(SetupBuildContext<T> context)
A function type that creates a setup function from a BuildContext.