Carrascado
08/23/2020, 3:34 PM(1..3).asFlow().onEach { number -> println("$number") }.collect()
And
(1..3).asFlow().collect { number -> println("$number") }
Why would I want to use onEach when I can use collect directly?araqnid
08/23/2020, 3:46 PMonEach followed by launchIn rather than collectflosch
08/23/2020, 3:47 PMonEach is most of the time used in combination with a tail .launchIn(CoroutineScope) instead of a surrounding Coroutinescope.launch { ... }araqnid
08/23/2020, 3:47 PMCarrascado
08/23/2020, 3:48 PMjean
08/23/2020, 7:53 PMonStart or catch when using onEachflosch
08/23/2020, 8:00 PMyou have the possibility to call other operators likeYou can also use those operators with collectoronStartwhen usingcatchonEach
jean
08/23/2020, 8:17 PMcollect or onEach , I should I specified that :)