composables/define_widget/reactivity
library
Functions
-
$asyncComputed<U>(Future<U> getValue(), {U? defaultValue, U? beforeUpdate()?, bool notifyBeforeUpdate = true, void onError(dynamic error)?, dynamic immediate = false})
→ AsyncComputed<U>
-
Creates an instance of AsyncComputed with the given async function.
-
$computed<U>(U getter())
→ Computed<U>
-
Creates a reactive Computed with the provided
getter
function.
The value is recomputed only when dependencies change and is guaranteed
to notify listeners when it is updated.
-
$ref<U>(U value)
→ Ref<U>
-
Creates a reactive Ref with the given initial
value
. This can be
used to store and notify changes to a mutable value over the lifetime
of the widget.
-
$watch(Iterable<Listenable?> source, VoidCallback callback, {bool immediate = false})
→ VoidCallback
-
Sets up a watcher on the given
source
and triggers the callback
when any
of the Listenable objects in the source change. If immediate
is true,
the callback
is triggered immediately after setting up the listener.
-
$watchEffect(VoidCallback callback)
→ VoidCallback
-
Sets up a reactive effect triggered by
callback
and returns a function
to dispose of the effect when it’s no longer needed.