Loadable

sealed interface Loadable<out T> : TrackedStatus(source)

The status of one piece of content that loads: the Toolkit's default, used as a field of a screen's state rather than for the whole screen.

Nothing makes a screen start at Loading: its ViewModel picks the first value. Content that is there from the start needs no Loadable at all, and a screen whose cases differ from these declares a sealed type of its own.

The screen_state labels are the ones the Toolkit has always reported: loading, success, no_data and error.

Inheritors

Types

Link copied to clipboard
data class Empty(val message: UiText? = null) : Loadable<Nothing>

There is nothing to show. message, if any, says why.

Link copied to clipboard
data class Failed(val message: UiText, val retryable: Boolean = true) : Loadable<Nothing>

Loading failed with message; retryable when trying again can help.

Link copied to clipboard
data object Loading : Loadable<Nothing>

The content is being loaded and there is none to show yet.

Link copied to clipboard
data class Ready<out T>(val value: T, val refreshing: Boolean = false, val stale: Boolean = false) : Loadable<T>

The content is here.

Properties

Link copied to clipboard
abstract val trackingLabel: String

The state parameter of the screen_state event.