jolt_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.
JoltSetupContext<T extends Widget>
The core context that manages hooks and reactive state for setup-based widgets.
Props<T extends Widget>
A reactive interface for accessing widget properties in setup functions.
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.

Mixins

SetupMixin<T extends StatefulWidget>
A mixin that brings setup-based composition API to StatefulWidget.

Extensions

JoltSetupMixinOnDidUpdateWidget on SetupMixin<T>
Extension for registering widget update callbacks on SetupMixin.
JoltSetupOnDidUpdateWidget on SetupWidget<T>
Extension for registering widget update callbacks on SetupWidget.

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.
onDidUpdateWidgetAt<T>(void callback(T, T)) → 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.
useInherited<T>(T getter(BuildContext)) → Computed<T>
Reactively tracks an InheritedWidget inside setup.
useMemoized<T>(T creator(), [void disposer(T state)?]) → T
Memoizes a value and optionally calls a disposer when unmounted.
useSetupContext() JoltSetupContext<Widget>
Gets the current JoltSetupContext.

Typedefs

WidgetFunction<T> = Widget Function()
A function type that builds a widget without parameters.