Sample App
A runnable Android sample lives in the repo's sample/android/ module — a single
Compose screen that exercises every claim in the docs, so one run of the app is a real smoke
test.
What it does
A default-store document, Documents.document<GameSave>("slot-1"), backs the
first section:
- Reset (set value) — a full
set()replacing the whole document. - Level +1 (update) and Coins +50 — both go through
update { current -> current.copy(...) }. - Player hp -10 — an
update { }that touches the nestedPlayersub-blob, proving nested@Serializabletypes round-trip correctly. - delete() — removes the document entirely.
Above the buttons, a live readout shows get() and exists(), plus a
separate readout bound to fieldFlow(GameSave::coins, default = 0) — proving that a
single decomposed field reacts on its own, independent of the whole-document flow.
A second section opens a separate Documents.collection("cache") holding a
Draft document, with Edit draft and Clear draft
buttons. The screen states its own test explicitly: editing the draft must never change the
slot-1 readout above — proving the collection is backed by a genuinely separate MMKV
file, isolated from the default store.
Run it
Clone the repository and run the sample:android module (Android only) from Android
Studio or via Gradle. See Reactive UI State for the
general pattern this sample demonstrates.