Connect with us

Media

Best Practices for using Kotlin Coroutines in Android Development

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 improve your Coroutine-based code a lot.

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”

Advertisement

Trending