Android 12 Developer Preview is here! Try it out, and give us your feedback!

RxSharedPreferencesMigrationBuilder

class RxSharedPreferencesMigrationBuilder<T>
kotlin.Any
   ↳ androidx.datastore.rxjava3.RxSharedPreferencesMigrationBuilder

RxSharedPreferencesMigrationBuilder for the RxSharedPreferencesMigration.

Summary

Public constructors
<init>(context: Context, sharedPreferencesName: String, rxSharedPreferencesMigration: RxSharedPreferencesMigration<T>)

RxSharedPreferencesMigrationBuilder for the RxSharedPreferencesMigration.

Public methods
DataMigration<T>

Build and return the DataMigration instance.

RxSharedPreferencesMigrationBuilder<T>
setKeysToMigrate(vararg keys: String)

Set the list of keys to migrate.

Public constructors

<init>

RxSharedPreferencesMigrationBuilder(
    context: Context,
    sharedPreferencesName: String,
    rxSharedPreferencesMigration: RxSharedPreferencesMigration<T>)

RxSharedPreferencesMigrationBuilder for the RxSharedPreferencesMigration.

Public methods

build

fun build(): DataMigration<T>

Build and return the DataMigration instance.

Return
the DataMigration.

setKeysToMigrate

fun setKeysToMigrate(vararg keys: String): RxSharedPreferencesMigrationBuilder<T>

Set the list of keys to migrate. The keys will be mapped to datastore.Preferences with their same values. If the key is already present in the new Preferences, the key will not be migrated again. If the key is not present in the SharedPreferences it will not be migrated.

This method is optional and if keysToMigrate is not set, all keys will be migrated from the existing SharedPreferences.

Parameters
vararg keys: String the keys to migrate
Return
this