odroe library

Classes

Lifecycle
reactive
Readonly<T>
The abstract interface of Signal.This is readable interface. expose the value getter.
Signal<T>
The Signal expose the value setter and toReadobly method.

Functions

batch<T>(T handler()) → T
The batch(fn) function can be used to combine multiple value updates into one "commit" at the end of the provided callback. Batches can be nested and changes are only flushed once the outermost batch callback completes. Accessing a signal that has been modified within a batch will reflect its updated value.
computed<T>(T getter(), {bool autoDispose = false, String? debugLabel}) Readonly<T>
Creates a new signal that is computed based on the values of other signals. The returned computed signal is read-only, and its value is automatically updated when any signals accessed from within the callback function change.
defineKey(Key key) → void
Define a Setup-widget key in current widget.
defineProps<T>(Iterable<T> props) → void
Define a props iterable in current sswetup-widget.
effect(dynamic handler(), {String? debugLabel}) → void Function()
To run arbitrary code in response to signal changes, we can use effect(fn). Similar to computed signals, effects track which signals are accessed and re-run their callback when those signals change. If the callback returns a function, this function will be run before the next value update. Unlike computed signals, effect() does not return a signal - it's the end of a sequence of changes.
isReactive(dynamic value) bool
Determine whether a value is a reactive object created by the reactive static functions.
isSignal(dynamic value) bool
Determine whether an object is a Signal or ReadonlySignal.
onActivated(void callback()) → void
Registers a callback to be called after the Setup-widget is inserted into the element as part of a tree cached by keep alive.
onBeforeUnmount(void callback()) → void
Registers a hook to be called right before a Setup-widget is to be unmounted.
onBeforeUpdate(void callback()) → void
Registers a hook to be called right before the Setup-widget is about to update its element tree due to a signals/props change.
onDeactivated(void callback()) → void
Registers a callback to be called after the Setup-widget is removed from the element as part of a tree cached by keep alive.
onMounted(void callback()) → void
Registers a callback to be called after the Setup-widget has been mounted.
onUnmounted(void callback()) → void
Registers a callback to be called after the Setup-widget has been unmounted.
onUpdated(void callback()) → void
Registers a callback to be called after the Setup-widget has updated its element tree due to a signals/props change.
props<T>() List<T>
Returns current setup-widget defined props list.
setup(SetupCallback fn) Widget
Define a Setup-widget.
signal<T>(T initialValue, {bool autoDispose = false, String? debugLabel}) Signal<T>
Creates a new signal with the given argument as its initial value:
untracked<T>(T getter()) → T
In case when you're receiving a callback that can read some signals, but you don't want to subscribe to them, you can use untracked to prevent any subscriptions from happening.
useContext() BuildContext
Returns a BuildContext by current setup-widget.

Exceptions / Errors

SignalsError
Signal usage error
SignalsReadAfterDisposeError
Error to throw if a signal is read after it is disposed
SignalsWriteAfterDisposeError
Error to throw if a signal is written to after it is disposed