~/talk

Practical Patterns for Kotlin Coroutines in Production

Talkat droidcon Berlin 2024 · 2024-07-03..07-05· [kotlin]
slides:none on file

Practical, actionable rules for Kotlin coroutines: never use async immediately await is pointless — start asyncs together and await later or use coroutineScope; prefer external scopes for fire-and-forget; handle cancellation as structured concurrency so use supervisorScope for independent children and avoid creating children in a scope that must await them; for cleanup use NonCancellable and never silence cancellation — don't swallow CancellationException; convert callbacks with suspendCancellableCoroutine or use callbackFlow + awaitClose for multi-value callbacks and wrap blocking IO with dedicated dispatchers.

AI-written summary · about

  1. 0:00Introduction
  2. 1:06Sync vs async calls with coroutines
  3. 3:16Parent-child coroutine scopes
  4. 6:12Cancellation mechanisms
  5. 9:21Supervisor scope basics
  6. 10:25Blocking ops in coroutines
  7. 11:31Non-cancellable cleanup
  8. 12:36Exception handling pitfalls
  9. 13:40Callback to suspend conversion
  10. 15:48Blocking APIs with Dispatchers.IO
  11. 17:34Sync with limited dispatchers
  12. 18:58Job join for completion
  13. 19:41CompletableDeferred sync
  14. 22:19Flow patterns optimization
  15. 24:46StateFlow vs SharedFlow
  16. 27:42Quiz & Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.