Created
July 25, 2024 09:37
-
-
Save aliElahi/a33fd57b2c5442909eac04784b09844f to your computer and use it in GitHub Desktop.
get data from DataStore Preference
This file contains 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
suspend fun geString(context: Context , key: String): String? { | |
val dataStoreKey = stringPreferencesKey(key) | |
val preference = context.dataStore.data.last() | |
return preference[dataStoreKey] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment