Building StateFlows in Android with Jetpack Compose
summary
Molecule turns the Compose runtime into a way to expose presenter logic as StateFlows by running a composable presenter inside a recomposer and emitting its return model to a flow. It uses an API like launchMolecule that accepts a scope, a context clock (or an immediate clock for tests), and the composable, and it supports cold flows too. Cash App uses composable presenters that combine flows, funnel UI events through channels, and test them with Turbine, enabling simpler imperative coroutine code and reliable tests.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 1:18What is Molecule
- 3:03Molecule basics and setup
- 6:39Converting to Molecule
- 9:27Understanding clocks
- 13:23Testing with clocks
- 17:18Architecture at Cash App
- 24:48Testing presenters
- 30:48How Molecule works
- 36:53Summary and thanks
related talks
26mMolecule: Using Compose for Presentation Logic
27mBuilding State Holders in Compose with Molecule
42mCompose: Beyond Android development
34mBeyond the UI: Compose as a Foundation for Multiplatform Apps
40mCompose Without Flow: Unidirectional State with Snapshots and Coroutines
30mModern Compose Architecture with Circuit
45mOn the road to Jetpack Compose
42mJetpack Compose: Art of the State
