Reactivity Model
MMKV has no native change-listener mechanism, so reactivity is entirely a process-local concern built on top of it.
The change bus
A single shared, process-local event stream acts as a change bus: after every committed write
or delete, the affected document's key is emitted onto that bus. document.flow()
filters the bus for its own key, then re-reads and emits the fresh value — conflated, so a burst
of rapid writes doesn't queue up redundant emissions. The initial value is emitted the moment a
collector starts collecting, before any new write has happened.
note.flow().collect { current ->
// fires once immediately with the current value, then again after every committed write
}
fieldFlow(prop) filters further, down to one field — a change to a sibling field
never triggers it. See Field Delegates.
Not cross-process
Because the change bus is process-local, cross-process change notification is not provided — a write made by another OS process will not show up as an emission on this bus. This is consistent with the single-process constraint that applies to storage generally: this library's reactivity, like its storage, is designed around a single owning process.