updateStateWith

context(viewModel: ViewModel)
inline fun <T : Any> MutableStateFlow<UiState<T>>.updateStateWith(crossinline operation: suspend T.() -> Result<T>)

Extension function to update the state of a MutableStateFlow with a suspend operation.

Parameters

T

The type of the data.

operation

A suspend function that returns a Result of the data.