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

Nick Williams

01/16/2023, 4:49 PM
I would expect the following to produce the same result: https://pl.kotl.in/et9gN2zjE
Copy code
suspend fun main() { 
	flow{ delay(100); emit("beef") }
      .onStart { emit("jerky") }
      .onStart { emit("turkey") }
      .conflate()     
      .collect { println(it) }
}
https://pl.kotl.in/Aypctiyc9
Copy code
suspend fun main() { 
	flow{ delay(100); emit("beef") }
      .onStart { emit("jerky") }
      .onStart { emit("turkey") }
      .debounce(1)     
      .collect { println(it) }
}
Is there a better way to guarantee only the first
onStart { emit(...) }
gets recieved by the collector?
debounce(1)
feels hacky
2 Views