Kotlin Coroutines: Deep Dive (Kotlin for Developers) 8396395837, 9788396395832

Kotlin coroutines revolutionized JVM development, especially on Android and the backend. They let us easily make efficie

945 241 22MB

English Pages 470

Report DMCA / Copyright

DOWNLOAD FILE

Kotlin Coroutines: Deep Dive (Kotlin for Developers)
 8396395837, 9788396395832

Table of contents :
Table of Contents
Introduction
Part 1: Understanding Kotlin Coroutines
Why Kotlin Coroutines?
Sequence builder
How does suspension work?
Coroutines under the hood
Coroutines: built-in support vs library
Part 2: Kotlin Coroutines library
Coroutine builders
Coroutine context
Jobs and awaiting children
Cancellation
Exception handling
Coroutine scope functions
Dispatchers
Constructing a coroutine scope
The problem with shared state
Testing Kotlin Coroutines
Part 3: Channel and Flow
Channel
Select
Hot and cold data sources
Flow introduction
Understanding Flow
Flow building
Flow lifecycle functions
Flow processing
SharedFlow and StateFlow
Testing flow
Part 4: Kotlin Coroutines in practice
Common use cases
Recipes
Using coroutines from other languages
Launching coroutines vs. suspending functions
Best practices
The End

Polecaj historie