DataState

class DataState<out T> @RestrictTo(value = [RestrictTo.Scope.LIBRARY_GROUP_PREFIX]) constructor(val loading: Boolean, val content: T?, val error: Throwable? = null)

DataState class to represent the different states of a value.

Parameters

T

The type of the content.

Constructors

Link copied to clipboard
constructor(loading: Boolean, content: T?, error: Throwable? = null)

Properties

Link copied to clipboard
val content: T?

The value, can be null if not available.

Link copied to clipboard
val error: Throwable? = null

The error if any, can be null.

Link copied to clipboard

True if the value is loading, false otherwise.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
inline fun <T> DataState<T>.UiStates(loading: @Composable () -> Unit, failure: @Composable (error: Throwable?) -> Unit, content: @Composable (content: T, loading: Boolean, error: Throwable?) -> Unit)

Composable function to render the different states of a DataState object.