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. An expect fun returning 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>
Installs
2
GitHub Stars
35
First Seen
5 days ago
datastore-kmp-manager — maxrave-dev/kotlin-footguns