ObservableValue

open class ObservableValue<T>(value: T) : MutableState<T>

The observable value class.

Parameters

value

the initial value

Constructors

Link copied to clipboard
constructor(value: T)

Properties

Link copied to clipboard
val <S> MutableState<S>.mutableStateFlow: <Error class: unknown class><S>

Extension property returning a MutableStateFlow for a MutableState.

Link copied to clipboard
val <S> ObservableState<S>.stateFlow: <Error class: unknown class><S>

Extension property returning a StateFlow for an ObservableState.

Link copied to clipboard
var value: T

The observed variable.

Functions

Link copied to clipboard
open override fun getState(): T

Get current state.

Link copied to clipboard
open override fun setState(state: T)

Set current state.

Link copied to clipboard
fun <S, T> ObservableState<S>.sub(contextWidget: Widget? = null, extractor: (S) -> T): ObservableState<T>

Returns a sub-store of the original ObservableState

Link copied to clipboard
open override fun subscribe(observer: (T) -> Unit): () -> Unit

Subscribe for the state change notifications. Calls the observer with the current state.