updateWith

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

scope

The CoroutineScope to launch the operation.

operation

A suspend function that returns a Result of Unit.