Package-level declarations

Types

Link copied to clipboard
interface Collection

A named group of documents backed by a single MMKV file.

Link copied to clipboard

Configuration for a Collection, populated in the Documents.collection block.

Link copied to clipboard
interface Document<T>

A typed, document-oriented view over a single key in storage.

Link copied to clipboard

Configuration for a single document opened on the default store, populated in the Documents.document block.

Link copied to clipboard

Thrown when a document cannot be decoded from storage.

Link copied to clipboard
object Documents

The entry point to the library. Open documents on the default store with document, or open a named Collection with collection when a separate MMKV file is warranted.

Link copied to clipboard

Bootstraps MMKV at process start so consumers never call MMKV.initialize themselves.

Functions

Link copied to clipboard
inline fun <T> Collection.document(key: String): Document<T>

Opens the Document at key in this collection, resolving the value type's serializer at the call site.

inline fun <T> Documents.document(key: String, noinline config: DocumentConfig.() -> Unit = {}): Document<T>

Opens the Document at key on the default store, resolving the value type's serializer at the call site.

Link copied to clipboard
inline fun <V> Document<*>.field(prop: KProperty1<*, V>, default: V): ReadWriteProperty<Any?, V>

A property delegate backed by the single decomposed key for prop on this document.

Link copied to clipboard
inline fun <V> Document<*>.fieldFlow(prop: KProperty1<*, V>, default: V): Flow<V>

A cold Flow of the value of the single field prop on this document.

Link copied to clipboard
inline fun <T, V> Document<T>.update(prop: KProperty1<T, V>, value: V)

Writes value directly to the single decomposed key for prop on this document, with no read of the rest of the document. Emits on the document's Document.flow.