incrementFrom

suspend fun MutableStateFlow<Int>.incrementFrom(flow: StateFlow<Int>)

Keeps this incrementedincrement by the latest value in the given flow.

For example, if this MutableStateFlow is initially set to 1 and flow is set to 1, 2, 0 then the value of this MutableStateFlow will be set to 2, then 3, then 1.


@JvmName(name = "incrementFromBoolean")
suspend fun MutableStateFlow<Int>.incrementFrom(flow: StateFlow<Boolean>)

Keeps this incrementedincrement by the latest value in the given flow.

For example, if this MutableStateFlow is initially set to 1 and flow is set to true, false, true then the value of this MutableStateFlow will be set to 2, then 1, then 2.