updateStateWith

inline fun <T : Any> MutableStateFlow<UiState<T>>.updateStateWith(scope: CoroutineScope, 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.

scope

The CoroutineScope to launch the operation.

operation

A suspend function that returns a Result of the data.