Created
August 29, 2022 10:37
-
-
Save cp-hardik-p/eeb7d8e8981045d33471aabb7c59746b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // get the user's age | |
| val userAgeFlow: Flow<Int> = context.dataStore.data.map { preferences -> | |
| preferences[USER_AGE_KEY] ?: 0 | |
| } | |
| // get the user's name | |
| val userNameFlow: Flow<String> = context.dataStore.data.map { preferences -> | |
| preferences[USER_NAME_KEY] ?: "" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment