Master Coroutine in 2 Hours: Free Course
I have created a two-hour high-quality course on Kotlin Coroutines along with source code. I bet you’ll love it.
Coroutines are a mess? No, it’s not. Trust me!
They are as wonderful as Taj Mahal 😎
I have organized this course into 5 chapters.
In chapter 1, get a solid understanding of what are coroutines.
- Explore the ‘suspend’ keyword, compare with threads, delay function, Thread.sleep function and a lot more.
- Basics of coroutine builders: launch, async, and runBlocking.
In chapter 2, dive deeper into Coroutine Builders and explore them in detail.
- Use GlobalScope companion object to launch coroutines.
- Why GlobalScope is discouraged to use?
- Test suspending functions by writing a JUnit test case.
In chapter 3, learn to cancel coroutines and handle exceptions.
- What is a cooperative coroutine?
- How to write cooperative code?
- Explore job.cancel(), and job.cancelAndJoin() functions.
- Use of yield() and delay() suspending functions (suspend modifier).
- Explore what is CoroutineScope.isActive boolean flag.
- Handle CancellationException and TimeoutCancellationException.
- Use withContext(NonCancellable), withTimeout, and withTimeoutOrNull coroutine builders
In chapter 4, compose suspending functions in different ways within a coroutine.
- Explore how code execution in coroutine is sequential by default.
- How to execute suspending functions in a coroutine concurrently?
- Lazily execute async coroutine by using CoroutineStart.LAZY
In chapter 5, learn a few advanced coroutine concepts.
- Understand what is CoroutineScope?
- What is CoroutineContext?
- What is a Dispatcher?
- Role of a dispatcher: to assign a thread to a coroutine.
- Types of Dispatcher: Confined, Unconfined, Default, Main, and IO
- Components of CoroutineContext: Job, Dispatcher, and CoroutineName.
Okay, let’s shut up and watch the course.
You can watch the course here 👇👇 — OR — click to watch on youtube. I prefer watching loooong videos on Youtube.
Let’s not forget the source code.
You will find the source code here on Github. Enjoy!
One clap, two claps, three claps ….. Forty!
If you want more such tutorials, subscribe to my youtube channel Smartherd. 100 thousand already did. Don’t wait!