update

inline fun <T> MutableStateFlow<T>.update(function: (T) -> T)(source)

Updates the MutableStateFlow.value atomically using the specified function of its value.

function may be evaluated multiple times, if value is being concurrently updated.