/kotlin-coroutine-examples

Examples using Kotlin coroutines

Primary LanguageKotlinMIT LicenseMIT

Kotlin coroutine examples

It attempts to explain various use-cases around coroutines in simple terms to explain them.

  1. concurrency: run multiple coroutines concurrently
  2. yield: using yield() to yield dispatcher to other coroutines
  3. default dispatcher: using Dispatchers.Default to run coroutines in parallel
  4. Thread pool: using a fixed Thread pool for coroutines
  5. async: async() and await()
  6. launch and exceptions: how to handle exceptions in coroutines
  7. async and exceptions: exceptions in async() coroutines
  8. produce: how to produce values and use ReceiveChannel
  9. actors: how to use actors in Kotlin
  10. flow: uing Flow to build sequential streams of events