launchUseState

fun <Result> launchUseState(context: CoroutineContext = coroutineContext, action: suspend (State) -> Result): Job

Launches in a given CoroutineContext and calls action on the current State. The state is guaranteed not to change during the execution of action. This operation ensures atomic state observations, so the state will not change while the action is being executed.

Parameters

Result

the type of the result to be returned

context

The CoroutineContext in which to use the state.

action

The action to execute on the current State

See also