Created
December 29, 2022 12:24
-
-
Save srikrishnasakunia/5dfaa0460be473127e690b91542358a6 to your computer and use it in GitHub Desktop.
Main Activity KT
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
// Retriving Using the Flow Method | |
lifecycleScope.launch { | |
preferenceDataStoreHelper.getPreference(NAME_KEY,"").collect { | |
name = it | |
} | |
} | |
// Retriving Using the Not Flow / static data Method | |
lifecycleScope.launch { | |
val name = preferenceDataStoreHelper.getFirstPreference(NAME_KEY,"") | |
} | |
// Setting Data | |
val name = "Android Developer" | |
lifecycleScope.launch { | |
preferenceDataStoreHelper.putPreference(NAME_KEY,name) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment