Set up Coroutine

This is my note for Udemy lesson: Advanced Android Bootcamp 2024.

1. Import Coroutine

Latest version can be found here.
In app's build.gradle, add the dependencies:

dependencies {
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.0"
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0"
}

2. Use It

CoroutineScope(Dispatchers.IO).launch {
  // heavy tasks
}