Best Practices for using Kotlin Coroutines in Android Development



Best Practices for using Kotlin Coroutines in Android Development

Best Practices for using Kotlin Coroutines in Android Development

🎓 Get the full 15+ hour-long Course “Kotlin Coroutines and Flow for Android Development” with a nice discount here: https://www.lukaslechner.com/coroutines-flow-android?source=youtube

In this video, I am going to show you 6 of the most important Best practices when using Kotlin Coroutines in your Android Applications. By following these Best Practices, you will greatly improve your Coroutine-based code.

Official Best Practices Article:
https://developer.android.com/kotlin/coroutines/coroutines-best-practices

👨‍🎓 Learn Coroutines and Flow with my Github Example Repository: https://github.com/LukasLechnerDev/Kotlin-Coroutine-Use-Cases-on-Android

TimeStamps:
00:00 – Intro
01:01 – Best Practice 1 – Inject Dispatchers to enable testing
05:18 – Best Practice 2 – Suspend functions should be safe to call from the main thread
07:10 – Best Practice 3 – ViewModels should create Coroutines instead of exposing suspend functions to perform business logic
10:07 – Best Practice 4 – The data and business logic should expose Suspend Functions or Flows
14:31 – Best Practice 5 – Avoid GlobalScope
17:18 – Best Practice – Make Coroutines cancellable
20:33 – Get the Full Course “Mastering Kotlin Coroutines for Android Development”

➤ Subscribe to the channel: https://www.youtube.com/channel/UCr9FeEqCspjGTiOc3HplCqw?sub_confirmation=1

🌎 Check out my website: https://www.lukaslechner.com

📬 Subscribe to my newsletter: https://www.lukaslechner.com/newsletter/

➤ Follow me on twitter: https://twitter.com/LukasLechnerDev

Comments are closed.