any way to write this in a more idiomatic way? (p...
# coroutines
a
any way to write this in a more idiomatic way? (particularly the exception throwing to exit
collect {}
)
s
Not sure if there is one, but maybe the
Flow
has a
takeUntil
method or something similar. Then you can just do a plain
collect
on that resulting Flow…
There is no
takeUntil
, but there is a
takeWhile
function for a Flow.
Ah.. I see you already use ‘takeWhile’…. hmmmm
b
I think you can use
first
here
👍 1
s
Also, I’m not sure where
over
in the code-snippet comes from….
a
I think I’ll just use `first {}`… it is good enough
also
over
does not matter… it is not in the context of the flow
g
using mutable state is not really idiomatic, why do you need this
last
?
a
it needed to be used outside of the try{} catch () statement
I don’t think it really related highly to the problem tho
I think
first{}
is good enough
g
first os good enough
I just worry to set it from collect instead of receive it from first() or other terminal operator