withState

abstract suspend fun withState(block: suspend S.() -> Unit)

Obtain the current state and operate on it without changing the state.

This function is reentrant, which means, if you call:

withState {
withState { }
}

you will not get a deadlock.