tmg
05/14/2020, 10:23 AMclass Foo {
suspending fun foo() { /* some code */ }
And inside it I would like to launch some child coroutines (and await their ending, so, like coroutineScope {}
), what’s the correct pattern for it?
I’ve seen people using class Foo : CoroutineScope
to be able use use launch or coroutineScope directly, but what does this actually do?araqnid
05/14/2020, 11:28 AMcoroutineScope
within any suspending function, no need to have a CoroutineScope receiver- it will create a new Job with a parent from the current context’s Joblaunch
etc to be able to access a context when run from a non-suspending function- the CoroutineScope interface is basically just a coroutineContext
propertytmg
05/14/2020, 11:47 AMYou can rundidn’t notice that 🤦 thanks!within any suspending functioncoroutineScope