dan.the.man
02/25/2021, 8:16 PMcollect
or onEach
to subscribe to the updates on StateflowPanu
02/25/2021, 8:22 PMwasyl
02/25/2021, 8:23 PMonEach { }.launchIn(scope)
if I recall correctlyonEach
is not starting the collection yet, so flowOf(…).onEach { println(it) }
won’t do anything. Only when you start collecting with collect { }
or launchIn
, the flow will be activedan.the.man
02/25/2021, 8:25 PMZach Klippenstein (he/him) [MOD]
02/25/2021, 8:58 PM.launchIn(scope)
and .collect()
are definitely not the same – the former will launch a new coroutine and return immediately, the latter will suspend until the flow terminates.