pausableState

fun <T> pausableState(key: String? = null, isActive: Boolean = LocalRecordLifecycle.current.isActive, produceState: @Composable () -> T): T(source)

Wraps a composable state producer, which will replay the last emitted state instance when isActive is false.

The class T returned from produceState is required to implement equals and hashCode methods correctly, otherwise this function can create composition loops.

Parameters

key

A unique key for the pausable state.

isActive

Whether the state producer should be active or not.

produceState

A composable lambda function which produces the state