arch-android

//Android/br.com.arch.toolkit.android.util/ConfigValue

ConfigValue

data class ConfigValue<T : Any>(name: String, default: T, storage: () -> KeyValueStorage)

A wrapper class that provides a way to observe and manage a configuration value stored in KeyValueStorage.

It provides both androidx.lifecycle.LiveData and kotlinx.coroutines.flow.Flow for observation.

Parameters

android

   
T The type of the value being stored.

Constructors

   
ConfigValue [android]
constructor(name: String, default: T, storage: () -> KeyValueStorage)

Properties

Name Summary
flow [android]
val flow: Flow<T>
Returns a kotlinx.coroutines.flow.Flow to observe changes to the value.
liveData [android]
val liveData: LiveData<T>
Returns a androidx.lifecycle.LiveData object to observe changes to the value.

Functions

Name Summary
get [android]
fun get(): T
Retrieves the current value.
set [android]
fun set(value: T)
Updates the value and persists it to storage.