Kotlin Coroutines Case study — Cleaning up an Async API
Nov 7 · 9 min read
Asynchronous code can get really messy really quickly. Callback hell was named callback hell for a reason. There are some good ways to avoid this in your design, but sometimes you have to live with an old, difficult to use async API. Maybe because it’s provided by a third party, or maybe it’s just too difficult to rip out and rewrite. What you can do in this case is write a Kotlin extension/wrapper on top of the API.
Kotlin Coroutines are a fantastic way to clean up async APIs. They can make your async code as easy to read and…

