oref
library
Classes
-
Derived<T>
-
Represents a derived value that depends on other reactive references.
-
Effect<T>
-
Represents a reactive effect that automatically tracks and responds to changes in reactive references.
-
EffectRunner<T>
-
Represents a runner for reactive effects.
-
Ref<T>
-
Represents a reactive reference to a value of type T.
-
Scope
-
Represents a scope for managing reactive effects and computations.
Extension Types
-
WatchHandle
-
A handle for controlling a watch operation.
Extensions
-
DerivedUtils
on Derived<T> Function<T>(T _())
-
Utility extension for creating different types of derived references.
Functions
-
batch(void runner())
→ void
-
Executes a batch operation.
-
createScope([bool detached = false])
→ Scope
-
Creates an effects scope.
-
customRef<T>(({T Function() get, void Function(T) set}) factory(void track(), void trigger()))
→ Ref<T>
-
Creates a custom Ref with user-defined getter and setter behavior.
-
derived<T>(T getter())
→ Derived<T>
-
Creates a new Derived reference.
-
effect<T>(T runner(), {void scheduler()?, void onStop()?})
→ EffectRunner<T>
-
Creates and runs an effect.
-
enableTracking()
→ void
-
Reenables effect tracking.
-
getCurrentScope()
→ Scope?
-
Returns the current active effects scope if there is one.
-
inferReturnType<F extends Function>(F fn)
→ F
-
Enables precise type inference for function return types.
-
isReactive<T>(T value)
→ bool
-
Checks if a value is reactive object.
-
isRef(dynamic value)
→ bool
-
Checks if a value is a Ref instance.
-
onEffectCleanup(void cleanup(), [dynamic failSilently = false])
→ void
-
Registers a cleanup function for the current active effect.
-
onScopeDispose(void cleanup(), [bool failSilently = false])
→ void
-
Registers a dispose callback on the current active effects scope.
-
pauseTracking()
→ void
-
Temporarily pauses tracking.
-
reactiveIterable<E>(Iterable<E> iterable)
→ Iterable<E>
-
Creates a reactive iterable from the given
iterable
.
-
reactiveList<E>(List<E> list)
→ List<E>
-
Creates a reactive list from the given
list
.
-
reactiveMap<K, V>(Map<K, V> map)
→ Map<K, V>
-
Creates a reactive map from the given
map
.
-
reactiveSet<E>(Set<E> set)
→ Set<E>
-
Creates a reactive set from the given
set
.
-
ref<T>(T value)
→ Ref<T>
-
Creates a value reference.
-
resetTracking()
→ void
-
Resets the tracking state to the previous value.
-
toRaw<T>(T value)
→ T
-
Converts a reactive object to its raw value.
-
triggerRef<T>(Ref<T> ref)
→ void
-
Triggers the update of a Ref instance.
-
unref<R>(dynamic ref)
→ R
-
Unwraps a Ref instance if the given value is a Ref, otherwise returns the value as-is.
-
untracked<T>(T runner())
→ T
-
Executes a function without tracking its dependencies.
-
watch<T extends Record>(T compute(), void runner(T value, T? oldValue), {bool immediate = false, bool once = false})
→ WatchHandle
-
Watches a computed value and runs a callback when it changes.