Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
fun showState(state: State) {
when (state) {
State.Loading -> println("loading")
is State.Content -> println("list size: ${state.list.size}")
is State.Error -> println("error: ${state.errorCode}")
State.Empty -> println("empty")
}.exhaustive
}
val Any?.exhaustive: Unit
get() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment