Setup

This library is distributed via maven central.

Add dependencies like following to use this library inside your project.

Simply add the dependencies inside your build.gradle.kts file.

build.gradle.kts
val kotpreferences = "<LATEST-VERSION>"

// core module
implementation("io.github.mflisar.kotpreferences:core:$kotpreferences")

// select a storage implementation
implementation("io.github.mflisar.kotpreferences:storage-datastore:$kotpreferences")
implementation("io.github.mflisar.kotpreferences:storage-keyvalue:$kotpreferences")

// optional extensions
implementation("io.github.mflisar.kotpreferences:extension-compose:$kotpreferences")

// optionally add additional encryption
implementation("io.github.mflisar.kotpreferences:encryption-aes:$kotpreferences")

Define the dependencies inside your libs.versions.toml file.

libs.versions.toml
[versions]

kotpreferences = "<LATEST-VERSION>"

[libraries]

# core module
kotpreferences-core = { module = "io.github.mflisar.kotpreferences:core", version.ref = "kotpreferences" }

# select a storage implementation
kotpreferences-storage-datastore = { module = "io.github.mflisar.kotpreferences:storage-datastore", version.ref = "kotpreferences" }
kotpreferences-storage-keyvalue = { module = "io.github.mflisar.kotpreferences:storage-keyvalue", version.ref = "kotpreferences" }

# optional extensions
kotpreferences-extension-compose = { module = "io.github.mflisar.kotpreferences:extension-compose", version.ref = "kotpreferences" }

# optionally add additional encryption
kotpreferences-encryption-aes = { module = "io.github.mflisar.kotpreferences:encryption-aes", version.ref = "kotpreferences" }

And then use the definitions in your projects like following:

build.gradle.kts
# core module
implementation(libs.kotpreferences.core)

# select a storage implementation
implementation(libs.kotpreferences.storage.datastore)
implementation(libs.kotpreferences.storage.keyvalue)

# optional extensions
implementation(libs.kotpreferences.extension.compose)

# optionally add additional encryption
implementation(libs.kotpreferences.encryption.aes)