Coroutines by Example
summary
Converts an Android app from RxJava streams to Kotlin coroutines by replacing Retrofit adapters with a Retrofit Deferred adapter, changing Singles/Completables to suspending functions, and using coroutine builders (launch/async) plus dispatchers (IO/Main/DB/computation). Replaces disposables with a parent composite Job and adapts a Room Flowable to a receive channel via openSubscription to ReceiveChannel, then compiles and runs the app successfully with network, DB caching, UI binding and diff calculation moved off the main thread.
AI-written summary · about
chapters (10)
- 0:00Introduction and setup
- 2:36Why use coroutines
- 6:45Five key coroutine facts
- 16:03Live coding introduction
- 16:44Adapting networking calls
- 19:53Using suspending functions
- 24:08Converting database operations
- 29:25Handling reactive streams
- 33:21Diff util example
- 36:55Final demo and summary
related talks
42mKotlin Coroutines: An Intro to Practical Use on Android
26mCoroutines and Rx: A Battle Towards Asynchronicity
42mI Swapped RxJava for Coroutines. Why You Should Too
20mLean Async Code with Kotlin's Coroutines
40mBuilding Asynchronous Mechanisms in Android App, Using Kotlin Coroutines
32mNetworking the Kotlin way: Retrofit + Coroutines
29mTrip into the async world
41mMaking a Kotlin, Architecture Components, Rx and Coroutines sandwich
