~/talk

5 Common Traps You Can Step Into When Using Coroutines

Talkat droidcon Berlin 2022 · 2022-07-06..07-08· [kotlin, android]
links:none on file
slides:none on file

Five concrete mistakes and fixes for Kotlin coroutines with code-level details: executing independent suspending calls sequentially instead of using async + awaitAll or mapping to individual awaits, forgetting coroutines are not cancelable by default and needing suspendCancellableCoroutine plus FusedLocationProviderClient and CancellationTokenSource, failing to make suspend functions main-safe by switching dispatchers, catching CancellationException unintentionally, and exposing suspend functions to the UI instead of using viewModelScope and state holders like StateFlow.

AI-written summary · about

  1. 0:00Introduction to coroutines
  2. 1:10Sequential API calls mistake
  3. 5:44Making coroutines cancellable
  4. 10:43Cancellation exception handling
  5. 13:57Exposing suspend functions in ViewModel
~/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.