Skip to content

Instantly share code, notes, and snippets.

View stevdza-san's full-sized avatar
💭
Kotlin Multiplatform Developer/Content Creator

Stefan Jovanovic stevdza-san

💭
Kotlin Multiplatform Developer/Content Creator
View GitHub Profile
@stevdza-san
stevdza-san / DataStoreRepository.kt
Last active October 6, 2025 04:37
Preferences DataStore - YouTube Tutorial | https://youtu.be/hEHVn9ATVjY
const val PREFERENCE_NAME = "my_preference"
class DataStoreRepository(context: Context) {
private object PreferenceKeys {
val name = preferencesKey<String>("my_name")
}
private val dataStore: DataStore<Preferences> = context.createDataStore(
name = PREFERENCE_NAME