UiState

data class UiState<T : Any>(val data: T, val loading: Boolean = false, val error: OneTimeEvent<Throwable?> = OneTimeEvent(null))(source)

Screen data with a loading flag and a consumable error event.

updateState replaces data synchronously; updateStateWith replaces it on returned success; updateWith preserves it. The wrapper has read-only properties, but OneTimeEvent has mutable consumption state. Copying a wrapper retains that event unless it is explicitly replaced.

Type Parameters

T

The non-null screen-data type; individual fields may be nullable.

Constructors

Link copied to clipboard
constructor(data: T, loading: Boolean = false, error: OneTimeEvent<Throwable?> = OneTimeEvent(null))

Properties

Link copied to clipboard
val data: T

Current renderable data, retained while an operation is loading or returns failure.

Link copied to clipboard

Error event, initially containing null. Consumption does not confirm display.

Link copied to clipboard

Flag used by StatefulComposable to show a loading indicator.