Storage

net.zagart.storage — module: core

Module

ModuleArtifactTargets
:corenet.zagart.storage:coreAndroid, JVM

Installation

commonMain.dependencies {
    implementation("net.zagart.storage:core:1.1.18")
}

Basic Usage

val storage = Storage.create(name = "my_app")

// Write
storage.putString("user", "name", "Alice")
storage.putBoolean("user", "notifications", true)

// Read
val name = storage.getString("user", "name", default = "Guest")

// Observe changes
storage.observe("user") {
    string("name")
    boolean("notifications")
}.collect { snapshot ->
    updateUI(snapshot)
}

Features

FeatureDetails
Scope-based storageOrganize data into named scopes (e.g. "settings", "user_profile")
Reactive observationObserve changes via Flow<Snapshot> using the DSL builder
Entity persistence@Entity-annotated classes persisted via SQLDelight with @Embedded flattening
Type-safe keysDefine keys and defaults using ObservationBuilder DSL
Compose-agnosticPure Kotlin — no Compose dependency

Platform Notes

Platformcreate() context
AndroidRequires Context as platformContext
JVMplatformContext = null

Versioning & Releases

  1. Bump version in core/build.gradle.kts
  2. Run ./gradlew :core:publishAllPublicationsToLocalRepository
  3. Tag and push: git tag v1.1.18 && git push origin v1.1.18
  4. Maven Central deployment happens automatically via daily CI
← Back