Is there a way to get the job a SharedFlow is laun...
# coroutines
a
Is there a way to get the job a SharedFlow is launched in? Basically, I want to do something like this
Copy code
// a method ...
val (sharedFlow, job) =  flow.shareIn(scope, SharingStarted.Eagerly)
jobs.add(job)
return sharedFlow
d
What are you doing with
jobs
? You could maybe create a
CoroutineScope
just to share the flow and you would have a
Job
with a single
Job
child.
a
jobs
is so I can cancel the flow
@Dominaezzz the point I am getting stuck at is creating the coroutine scope … with the default builder this is not possible afaik
oh wait I think I can just do `CoroutineScope()`… that’s easy
aha
d
Ah, if it's for cancellation, you just definitely use a
scope
and
Job
then. Much easier imo.