Kotlin Coroutines: Fundamentals

Learn the fundamentals about threads and coroutines, along with the basics of the Kotlin Coroutines framework. By Karol Wrótniak.

5 (1) · 1 Review

Download materials
Save for later

Who is this for?

Beginner Android developers who want to learn about threading, what coroutines are, and how to launch a coroutine in Android.

Covered concepts

  • Blocking & Non-Blocking calls
  • Synchronous vs. Asynchronous code
  • Threads
  • Main or UI Thread
  • Posting data to the UI
  • Kotlin Coroutines
  • Coroutine Builders
  • Dispatchers
  • Jobs
  • Suspending functions
  • Coroutine contexts
  • Coroutine scopes
  • Nested coroutines

Part 1: Getting started with Coroutines

Toggle description

Learn about blocking calls, background processing, creating threads and why using coroutines is increasingly popular!

Toggle description

Discover the purposes of coroutines, and how they can help you write asynchronous code in a simple way.

Toggle description

Learn about suspending functions, differences between suspending and blocking functions, and how delay() works.

Implement a simple coroutine calling a suspending function, and learn how to use the suspend modifier in practice.

Part 2: Deep Dive into Coroutines

Understand the coroutine contexts and dispatchers, and how to choose the right ones for your needs.

Use Coroutine Builders: launch, async, runBlocking.

Learn about coroutine scopes and the structured concurrency in Kotlin Coroutines.

Toggle description

Understand the coroutine jobs, their hierarchy and learn how to cancel a coroutine and its children.

Toggle description

Learn about async/await, how to use them to execute multiple coroutines in parallel.

Toggle description

Learn about coroutine exception handlers, and how to debug the coroutines.

Use all the knowledge you’ve gained to implement an API call using coroutines with exception handling in a composable.