reactormonk
09/09/2024, 6:49 PMflow { } via a bunch of emit(). Is there a way to terminate said flow, such that last() on the flow returns something?kevin.cianfarini
09/09/2024, 6:52 PMreactormonk
09/09/2024, 6:53 PMFlow with flow { } where an attached collect { } would terminate?kevin.cianfarini
09/09/2024, 6:55 PMflow { emit(1) }.collect { ... }
println("Got here")
But I still expect I’m misunderstanding your question. Not every flow is infinite.reactormonk
09/09/2024, 6:56 PMflow { } via return@flow, which doesn't seem to terminate the flow 😅kevin.cianfarini
09/09/2024, 6:57 PMreactormonk
09/09/2024, 6:58 PMwhen block, otherwise it's original: https://gist.github.com/reactormonk/e82c1af9a766be1370b0bc70acd10ff4kevin.cianfarini
09/09/2024, 7:02 PMreturn@flow) to see if you can reproduce.reactormonk
09/09/2024, 7:06 PMshareIn to run the flow, does the flow termination transfer there?reactormonk
09/09/2024, 7:07 PMkevin.cianfarini
09/09/2024, 7:10 PMkevin.cianfarini
09/09/2024, 7:11 PMShared flow never completes. A call to Flow.collect on a shared flow never completes normally, and neither does a coroutine started by the Flow.launchIn function. An active collector of a shared flow is called a subscriber.
kevin.cianfarini
09/09/2024, 7:11 PMreactormonk
09/09/2024, 7:11 PMkevin.cianfarini
09/09/2024, 7:12 PMkevin.cianfarini
09/09/2024, 7:12 PMkevin.cianfarini
09/09/2024, 7:12 PMreactormonk
09/09/2024, 7:12 PMreactormonk
09/09/2024, 7:13 PMkevin.cianfarini
09/09/2024, 7:13 PMkevin.cianfarini
09/09/2024, 7:14 PMsharedflow.takeWhile { it != Complete }.collect()reactormonk
09/09/2024, 7:16 PMfilterIsInstance even downcasts it for me.reactormonk
09/09/2024, 7:17 PMkevin.cianfarini
09/09/2024, 7:19 PM