updateState

abstract suspend fun updateState(transform: suspend S.() -> S)

Obtain the current StateProvider.state and update it with the result of transform.

  • This function will suspend until all previous withState or updateState invocations are finished if StoreConfiguration.atomicStateUpdates are enabled.

  • This function is reentrant, for more info, see withState

  • If you want to operate on a state of particular subtype, use the typed version of this function.

  • If you wish to ignore plugins and thread-safety of state updates in favor of greater performance, see ImmediateStateReceiver.updateStateImmediate.

See also

updateStateImmediate