hfhbd
01/26/2022, 5:13 PMnull
until b emits values. After b emits some values, the last value of b should be used (combine).hfhbd
01/26/2022, 5:14 PMval a = flow {
var counter = 0
while (true) {
emit(counter)
counter++
delay(1.seconds)
}
}
val b = flow {
delay(2.seconds)
emit("a")
delay(2.seconds)
emit("b")
delay(2.seconds)
}
val expected = listOf(1 to null, 2 to null, 3 to null, 4 to "a", 5 to "a", 6 to "b", 7 to "b")
Joffrey
01/26/2022, 5:15 PM.onStart { emit(null) }
on b
to ensure you get the first (null) value of b
to combine with all first values of a
- didn't think it through but I think it should workephemient
01/26/2022, 5:17 PM.onStart { emit(null) }
should work with `.combine()`; not .zip()
of courseJoffrey
01/26/2022, 5:17 PMemit
hfhbd
01/26/2022, 5:18 PMephemient
01/26/2022, 5:18 PMephemient
01/26/2022, 5:19 PMhfhbd
01/26/2022, 5:20 PMJoffrey
01/26/2022, 5:23 PMb
a Flow<String?>
up front for onStart
to be able to emit null
hfhbd
01/26/2022, 5:24 PMmap