Stay organized with collections Save and categorize content based on your preferences.

PreferenceDataStoreFile

public final class PreferenceDataStoreFile


Summary

Public constructors

Public methods

static final @NonNull File

Generate the File object for Preferences DataStore based on the provided context and name.

Public constructors

PreferenceDataStoreFile

public PreferenceDataStoreFile()

Public methods

PreferenceDataStoreFile.preferencesDataStoreFile

public static final @NonNull File PreferenceDataStoreFile.preferencesDataStoreFile(
    @NonNull Context receiver,
    @NonNull String name
)

Generate the File object for Preferences DataStore based on the provided context and name. The file is in the this.applicationContext.filesDir + "datastore/" subdirectory with name. This is public to allow for testing and backwards compatibility (e.g. if moving from the preferencesDataStore delegate or context.createDataStore to PreferencesDataStoreFactory).

Do NOT use the file outside of DataStore.

the context of the application used to get the files directory

the name of the preferences