Skip to content

Instantly share code, notes, and snippets.

@vaibhavgoyal09
Created August 10, 2021 15:30
Show Gist options
  • Save vaibhavgoyal09/6b369d7f071daec8b323f35e7851a36c to your computer and use it in GitHub Desktop.
Save vaibhavgoyal09/6b369d7f071daec8b323f35e7851a36c to your computer and use it in GitHub Desktop.
override suspend fun putString(key: String, value: String) {
val preferencesKey = stringPreferencesKey(key)
context.dataStore.edit { preferences ->
preferences[preferencesKey] = value
}
}
override suspend fun putInt(key: String, value: Int) {
val preferencesKey = intPreferencesKey(key)
context.dataStore.edit { preferences ->
preferences[preferencesKey] = value
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment