ComputedValue
Computed value for values of type T.
Computed values should depend on other values. These dependencies may be defined via the dependency function, by providing the path of the dependency relative to the value being computed.
Example computed value which computes the sum between two other values:
object MySum : ComputedValue<Int>() {
private val ComputedValueContext.value1: Int? by dependency("../value1")
private val ComputedValueContext.value2: Int? by dependency("../value2")
override suspend fun ComputedValueContext.compute(): Int = (value1 ?: 0) + (value2 ?: 0)
}Content copied to clipboard
Inheritors
Properties
Link copied to clipboard
Dependencies of the computed value. Mapping of keys to the paths this computed value depends on. Keys can be used within a ComputedValueContext to access the value of the dependencies.
Link copied to clipboard
Set of external context dependencies of the computed value.
Functions
Link copied to clipboard
Runs the computation within a ComputedValueContext containing the value of all declared dependencies. Returns the computed value.