Skip to content

Instantly share code, notes, and snippets.

@aliElahi
Created July 25, 2024 09:37
Show Gist options
  • Save aliElahi/a33fd57b2c5442909eac04784b09844f to your computer and use it in GitHub Desktop.
Save aliElahi/a33fd57b2c5442909eac04784b09844f to your computer and use it in GitHub Desktop.
get data from DataStore Preference
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