DataState
DataState Contains three different state:
Success : returned data
Error : thrown exception
Loading : initialize state
Example:
fun main() {
val state: DataState<Int> = DataState.Success(1)
when (state) {
is DataState.Success -> println(state.data)
is DataState.Error -> println(state.exception)
is DataState.Loading -> println("Loading")
}
}
Content copied to clipboard
Since
1.3.0