Coroutines for beginners: the only article you’ll need to get started!
When we shifted to Kotlin at Gradeup, we realised that the www was pretty unfriendly for a coroutine beginner- there was a lot of information available but one had to really go through a ton of articles for Coroutines to start making any sense! I often ended up fumbling through the internet, having words like scope, dispatchers, builder, asyncawaitsuspendaaaaaaaah! thrown in my face, and after I could finally decipher Coroutines, I decided to use my bad experience to create a good one for all the fellow Coroutine-noobs out there. So here’s presenting this comprehensive article!
We shall be covering the following:
- What are Coroutines?
- Suspend functions.
- Coroutine Builders.
- Coroutine Dispatchers.
- Coroutine Scope.
- Coroutine Jobs.
- Error handling in Coroutines.
1. Say, what are Coroutines?
Coroutines are “light weight threads” : if you say that one more time, I am going to hang myself, pun intended :D
If you have searched for Coroutine tutorials online, chances are that you must have come across this oversimplified statement: Coroutines are light weight…