This message was deleted.
# coroutines
s
This message was deleted.
j
You can't detect this per-se, but using
first()
or
single()
will cancel the flow after the first element. So depending on your use case you might be able to use
onCompletion { }
or something like that. What are you trying to achieve?
j
Okay, i need a conditional to detect if need subscribe on events after first requests
In this case, as the flow does not allow detecting this, I need to create a parameter for this conditional
j
Why not expose a simple suspend function for the case where the user needs a single value, and expose a flow-based function for an actual subscription? It seems these are pretty different cases
If you want to be "generic", what about the callers that use
take(2)
?
j
Yeah, maybe is better two functions
Thanks