Akhil Jain
12/06/2023, 1:06 PMmarlonlom
12/06/2023, 1:13 PMAkhil Jain
12/06/2023, 1:18 PMdataStoreManager.getDataStore(prefName, prefAlreadyExists).edit {
it.remove(preferencesKey<T>(prefKey))
}
suspend fun <T> DataStore<Preferences>.storeValue(key: Preferences.Key<T>, value: T) {
this.edit {
it[key] = value
}
}
We are using above code for storing/removingmarlonlom
12/06/2023, 1:27 PMviewModelScope.launch { datastoreManager.storeValue(...) }Repository:
/* inside a suspend function or flow { ... } */
datastoreManager.storeValue(...)