Coroutine scope

With the release of version 0.26.0 of coroutines, a new, important feature was introduced—coroutine scope. All of the coroutine builders from the coroutines-core library are extension functions of the CoroutineScope interface.

The CoroutineScope interface looks as follows:

public interface CoroutineScope {       @Deprecated(level = DeprecationLevel.HIDDEN, message = "Deprecated in favor of top-level extension property")    public val isActive: Boolean        get() = coroutineContext[Job]?.isActive ?: true    public val coroutineContext: CoroutineContext}

We need the coroutine scope to provide a proper cancellation mechanism for the coroutines that we launch in our application. Modern frameworks, such as Android SDK or React Native, are built ...

Get Learn Spring for Android Application Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.