datastore-kmp-manager
Installation
SKILL.md
A preferences manager across platforms
Three files, three jobs:
core/domain— the interface. Feature code depends on this and nothing else.core/data— the implementation. The only place the storage library is imported, and the only place key names exist.core/data/<platform>— the store instance. Anexpect funreturning the store, whose actuals each contain only a file path — construction is delegated to one shared function.
// commonMain — shared creation, one line per platform below it
fun createDataStore(producePath: () -> String): DataStore<Preferences> =
PreferenceDataStoreFactory.createWithPath(produceFile = { producePath().toPath() })
expect fun createDataStoreInstance(): DataStore<Preferences>