Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@ import kotlinx.coroutines.flow.map
val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = "settings")
// [END android_datastore_preferences_create]

/*
// [START android_datastore_preferences_migrate]
// Be sure to pass the original SharePreferences name when creating the migration.
private val SETTINGS_NAME = "settings"

private val Context.dataStore by preferencesDataStore(
name = SETTINGS_NAME,
produceMigrations = { context ->
listOf(SharedPreferencesMigration(context, SETTINGS_NAME))
}
)
// [END android_datastore_preferences_migrate]
*/

class PreferencesDataStore(private val context: Context) {

// [START android_datastore_preferences_read]
Expand Down
Loading