updateWith

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

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

Parameters

T

The type of the data.

operation

A suspend function that returns a Result of Unit.