https://kotlinlang.org logo
#flow
Title
# flow
o

Oleh Havrysh

08/11/2020, 3:33 PM
Hi! Is there something similar to MutableStateFlow, but without “state”? I just want simple entity that allows to pass items from one place and listen for changes at another. So, I don’t need getting last sent item after calling collect(), only new items
w

wasyl

08/11/2020, 5:12 PM
Seems like you’re looking for an alternative to rx subject, so this discussion might be relevant https://kotlinlang.slack.com/archives/C1CFAFJSK/p1597146129387900
g

gildor

08/12/2020, 2:51 AM
Just add drop(1) to skip initial value, it will have the same behaviour as you want:
Copy code
private val mutableState = MutableStateFlow("initiali value")
val state get() = mutableState.drop(1)
2 Views