Failure
Functions
Link copied to clipboard
inline fun <T> UiState<T>.Content(crossinline onSuccess: @Composable (data: T) -> Unit, noinline onLoading: @Composable () -> Unit? = null, noinline onIdle: @Composable () -> Unit? = null, noinline onFailure: @Composable (throwable: Throwable) -> Unit? = null)
Exhaustively renders UI content based on the current UiState.
Link copied to clipboard
Returns the encapsulated throwable if this state is UiState.Failure, or null otherwise.
Link copied to clipboard
inline fun <T, R> UiState<T>.fold(onSuccess: (data: T) -> R, onFailure: (throwable: Throwable) -> R, onLoading: () -> R, onIdle: () -> R): R
Applies onSuccess if state is UiState.Success, onFailure if UiState.Failure, onLoading if UiState.Loading, or onIdle if UiState.Idle.
Link copied to clipboard
Returns the encapsulated data if this state is UiState.Success, or default otherwise.
Link copied to clipboard
Returns the encapsulated data if this state is UiState.Success, or throws the encapsulated Throwable if this state is UiState.Failure, or an IllegalStateException if UiState.Idle or UiState.Loading.
Link copied to clipboard
Transforms the UiState.Success data using the given transform function. Non-success states (UiState.Idle, UiState.Loading, UiState.Failure) are passed through unchanged.