core library

Classes

Computation
A Computation describes a live action that automatically runs in response to when state inside the Computation updates. These can be thought of as side effects that occur when state objects update their data.
Computations
The Computations namespace manages the stack of the currently running Computations. The Computations namespace exposes a small API to read and write to this stack, although this is preferably not used outside of the core APIs of rxs.
Model
A Model is a unit of data, ranging from basic primitives such as boolean values, to complex classes composed of other Models.
ReadOnlyState<T>
Data that only provides the user direct access to reading its value; it does not provide the user direct access to writing its value.
State<T>
State represents any data that should be remembered during the lifetime of the application's runtime, the State classes themselves functioning as a container that enables rxs to perform its magic. The value of the wrapped data is subject to change over time, but will not change its type over time unless specified as dynamically typed.
WritableState<T>
Data that allows the user both direct read and write accesss to its value.

Properties

noop Computation
No operation. Used internally by ref.
final
parentComputation Computation?
The currently running Computation.
no setter

Functions

compute(ComputeAction action) Computation
Immediately computes the provided action. The action is a plain Dart function that rxs will automatically treat as "live", where it will be eagerly recomputed whenever any of its stateful dependencies is updated.
on<S, D>(D dependencies, S action(D dependencies)) → S
A utlity function to explicitly declare the dependencies of the given action. State used within the action that are not part of the action's dependencies will not trigger a recompute since the action has been wrapped within a ref.
ref<T>(T data()) → T
Create a plain reference to the given data within a computation. A ref informs any compute functions that they should not depend on the data wrapped within the ref.
state<T>([T? data]) WritableState<T>
Declare the given data as Stateful.

Typedefs

Action<T> = T Function()
A function that may optionally return a value. Core primitive of computations.
CleanupAction = Action<void>
The action to perform when a computation is freed.
ComputeAction<T> = Action<T>
An action that re-runs when state inside of it updates. A ComputeAction is guaranteed to run at least once during the lifetime of the ComputeAction.
Untracked<T> = Action<T>
Mark that the state used should not update a computation.