```flow { while (true) { delay(1000) ...
# coroutines
n
Copy code
flow {
    while (true) {
        delay(1000)
        emit(Unit)
    }
}
?
👍 1
👌 2
s
That is the cool thing about coroutines (and Flows). You can code your own special flow behaviors, operators, etc in a very imperative/sequential way. 🙂
n
hehe yeah that is almost too easy honnestly
😄 1
l
Note that this cannot be used for a timer because it doesn't take into account the execution time delay adding up, nor emit taking some time to resume (because the lambda of collect would take some time).
j
Hi, coming over from another Slack-Thread about internal "collect" vs.
launchIn {}
, just to be clear on flow consumption: the canonical way to consume is: a) toList() b) launchIn(...) .. else ?