Lucas
08/02/2022, 1:27 AMTrevor Stone
08/02/2022, 1:37 AMclass Test{
suspend fun test() = coroutineScope{
launch{ do things}
}
}
might be what you're looking forLucas
08/02/2022, 1:41 AMIvan Pavlov
08/02/2022, 6:11 AMthis.launch
Chrimaeon
08/02/2022, 3:28 PMlaunch
a coroutine. That's what the warning is telling you.Lucas
08/02/2022, 4:02 PMsuspend fun test() {
launch{ do things}
do other things
}
What if i wanted this? It would still show a warningIvan Pavlov
08/02/2022, 4:03 PMsuspend fun test() {
coroutineScope {
// access scope here
}
}
Chrimaeon
08/02/2022, 4:10 PMlaunch
in a “new” coroutineScope{}
like already mentioned, to give the job it’s own inner scopeLucas
08/02/2022, 4:11 PMTrevor Stone
08/02/2022, 4:23 PMlouiscad
08/07/2022, 8:53 AMcoroutineScope { }
inside suspend functions.