Dsittel
05/20/2020, 9:50 AMEvan R.
05/20/2020, 12:17 PMdoAlgorithm(Int, Flow<Int>)
).
If you invoke the cancel()
function within your coroutineScope, due to structured concurrency any running coroutines launched within the scope will be cancelled automatically just like the code in the launch { }
block in this example. You’ll also need the return@coroutineScope
so aResult
can be smart-cast to Int
from Int?
, as cancel doesn’t immediately cause a return.Dsittel
05/20/2020, 3:52 PM