~/talk

Using Kotlin Flow in MVVM

Talkat droidcon Berlin 2021 · 2021-10-20..10-22· [android]
speakerdeck:fgiris
slides:none on file

Shows replacing LiveData and suspend calls with Kotlin Flow using a fake repo that emits loading then a 1s-delayed random result, and a separate while(true) stream emitting once per second to simulate real-time updates. Demonstrates converting Flow to UI with asLiveData or collecting directly with lifecycleScope.launchWhenStarted / repeatOnLifecycle, uses operators like map/filter/onEach/flowOn/catch, and tests flows with runBlocking, collectIndexed/toList and a TestCoroutineDispatcher replacing Dispatchers.Main so unit tests run deterministically.

AI-written summary · about

  1. 0:00Introduction
  2. 2:54LiveData in MVVM
  3. 6:45Flow basics and advantages
  4. 8:11Flow with LiveData
  5. 10:41Real-time data streams
  6. 11:03Flow operators overview
  7. 14:34LiveData vs Flow
  8. 15:36Using Flow alone
  9. 18:04Testing Flow
~/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.