Coroutine + Flow = MVI
summary
Shows how MVI uses immutable state and unidirectional data flow with Kotlin Coroutines and Kotlin Flow to avoid race conditions and remove RxJava complexity. Builds an "Upvote" app: button clicks become flows via callbackFlow, view events map to intent reducers, intents funnel through a rendezvous channel and update a conflated broadcast channel as the model store. Coroutine scopes manage lifecycle; code is small and works live, with coroutines libs ~160KB versus RxJava ~1.5MB.
AI-written summary · about
chapters (20)
- 0:00Introduction and setup
- 1:17MVI pattern explained
- 3:03RxJava vs Coroutines/Flow
- 6:34Reactive programming basics
- 7:37MVI in reactive systems
- 8:18Building the sample app
- 9:21Flow of view events
- 11:05Mapping button clicks to events
- 12:28Merging event streams
- 14:58Setting up coroutine scope
- 16:42Consuming flows safely
- 17:24Intent factory creation
- 17:48Model state and immutability
- 19:11Intents as reducer functions
- 20:35Model store implementation
- 21:58Understanding Kotlin channels
- 24:01Binding intents to model
- 27:30Handling network calls
- 28:12Connecting view to model
- 29:35Project resources and Q&A
related talks
37mFlowing Things, Not So Strange in the MVI World
24mUsing Kotlin Flow in MVVM
42mGo with the Flow
28mComposing Magic with MVI and Kotlin StateFlow
44mGoing with the Flow - Using Coroutines 1.3.x
29mKotlin State & Shared Flows in Action
38mMigrating from LiveData to Coroutines and Flow
18mMVI made for Android
