Created
July 4, 2022 12:20
-
-
Save wajahatkarim3/a1ab22e3972e402ca2ebb16d89a62682 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 DataStore object | |
private val settingsDataStore by preferencesDataStore(name = “app_settings”) | |
// Get the keys | |
val myStrKey = stringPreferencesKey("myStrKey") | |
// Write the values through coroutine scopes | |
lifecycleScope.launch { | |
settingsDataStore.edit { pref -> | |
// Write the values here | |
pref[myStrKey] = “SOME VALUE TO WRITE HERE” | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment