Hi, I'm using a `MutableSharedFlow` with a collect...
# coroutines
g
Hi, I'm using a
MutableSharedFlow
with a collect lambda.
Copy code
val responseFlow = MutableSharedFlow<Message>(replay = 0)
...
responseFlow.collect {
...
}
When I collect a message, I do a test and for some value , I would like to leave the collect function and return a value. I'm not sure how to do that. Any idea?
w
Do you only care about that specific value? You can do
flow.first { condition }
for example
g
Oh! I did not know. Let me try that
It works, I'm a bit ashamed by such a simple solution... thank you !
👍 1