~/talk

State Machines with Kotlin Flow

Talkat DevBreak 2021 · 2021-09-08..09-09· [kotlin, reactive-programming]
links:none on file
slides:none on file

Implements a finite state machine atop Kotlin coroutines using MutableStateFlow as a hot, conflated shared flow that guarantees ordered, thread‑safe updates; transitions are emitted synchronously to collectors and missing mappings emit a NoMappingException on an error flow. Uses a coroutine scope with SupervisorJob and a CoroutineExceptionHandler, exposes transitions and errors as read‑only flows, and returns a Job for each transition so callers can cancel long operations. Provides a Kotlin DSL for state/action mappings (turnstile and water‑glass examples), has tests but is labelled opinionated and not production‑guaranteed.

AI-written summary · about

  1. 0:00Intro
  2. 1:01Why Kotlin Flow
  3. 1:16More serious reasons
  4. 2:03Finite State Machines
  5. 3:59Kotlin
  6. 4:45Launching Core Things
  7. 6:02Scope Context
  8. 8:51Core Routines
  9. 11:55Flows Channels
  10. 13:41Channels vs Flows
  11. 17:48State Flow
  12. 21:26Disclaimer
  13. 24:22Interface
  14. 27:40Implementation
  15. 31:42Transition Function
  16. 36:31Creating State Machines
  17. 38:19State Machine Example
~/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.