Mutable Remember
A mutable reactive value that can be set directly or calculated automatically from dependencies.
When not overridden, the value is calculated in a reactive context and updates automatically when dependencies change. When overridden by direct assignment, automatic calculation is paused until reset()
is called.
Note:
MutableRemember
is lazy: if it has no listeners, it will not calculate a value.Listeners are only notified if the calculated or set value changes.
The
reset()
method restores automatic calculation and updates the value from dependencies.
Parameters
The coroutine context for running the calculation.
The block to compute the initial value reactively.
Constructors
Functions
Adds a listener and immediately runs it once.
Adds the listener to be called every time this event fires.
Asserts a condition on this MutableReactive instance and reports an issue if the condition fails.
Adds a validation check to a MutableReactive instance, returning a MutableValidated that tracks issues.
'Lenses' a new type from this MutableReactive. This is useful when translating one type to another for user input, or safe type coercion.
'Lenses' a subtype from this MutableReactive. This is useful for extracting properties from a data class or modifying a single item in a collection.
THIS ONLY WORKS IF THE set
on the receiver never manipulates the input before notifying.
Adds a validation check to this MutableReactive instance.
Wraps a MutableReactive as a MutableValidated.
Validates that the value of this MutableReactive is not blank (for String values).
Validates that the value of this MutableReactive is not null.