Yauhen Pelkin
10/31/2019, 6:41 AMval flow1 : Item = getDbDataFLow1()
val flow2 : Item = getDbDataFLow2()
val flow3 : List<Item> = getDbDataFLow3()
flow1.zip(flow2) {a,b->
if(b.isOk())
listOf(a, b)
else
listOf(a)
}.zip(flow3) { ab, c ->
ab+c
}.collect{
println(it)
}
but when i am updating db record which corresponds flow1, flow1 and flow2 are triggering but nothing goes to second zip, so I fixed this in following ugly way
flow1.zip(flow2) {a,b->
if(b.isOk())
listOf(a, b)
else
listOf(a)
}.collect{
listOf(it)
.asFlow()
.zip(flow3) { ab, c ->
ab+c
}.collect{
println(it)
}
}
Could anyone help to understand what is wrong with original code, and how to change it in a good way?