onIdle

fun <T> State<T>.onIdle(block: @Composable () -> Unit)

Executes the given composable block if the State is State.Idle.

This is a convenience function to simplify conditional rendering based on the state.

Example usage:

val myState: State<String> = ...

myState.onIdle {
Text("Waiting for data...")
}

Parameters

block

The composable block to execute if the state is Idle.