Skip to content

Instantly share code, notes, and snippets.

@egorikftp
Created Aug 22, 2021
Embed
What would you like to do?
val EXAMPLE_COUNTER = intPreferencesKey("example_counter")
val exampleCounterFlow: Flow<Int> = context.dataStore.data
.map { preferences ->
// No type safety.
preferences[EXAMPLE_COUNTER] ?: 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment