sf1.combine(sf2) { a, b -> a + b }
.stateIn(scope, SharingStarted.Eagerly, initialValue = listOf())
.onEach { println(it) }
.launchIn(scope)
Then I don't have [1, -1] list in combined flow. I changed initialValue to sf1.value + sf2.value and now it works but I think that I could miss something which simplifies this. Is there a better way?
m
myanmarking
03/11/2021, 10:20 AM
by the time you use combine, the first value for sf1 get’s lost because only the last value is ‘cached’. It is my understanding