Android Developer
hardandroid-kotlin-coroutines

How do Kotlin coroutines work and how do you avoid common coroutine bugs?

Answer

Coroutines provide structured concurrency for async work. Best practices: - Use the right scope (viewModelScope, lifecycleScope) - Cancel work on lifecycle events - Avoid blocking calls on Dispatchers.Main - Handle exceptions and supervision Interview tip: mention flows for streams and structured cancellation to prevent leaks.

Related Topics

KotlinCoroutinesAndroid