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

DataStoreFile

public final class DataStoreFile


Summary

Public methods

static final @NonNull File
DataStoreFile.dataStoreFile(
    @NonNull Context receiver,
    @NonNull String fileName
)

Generate the File object for DataStore based on the provided context and name. the file is generated by calling File(context.applicationContext.filesDir, "datastore/$fileName").

Public methods

DataStoreFile.dataStoreFile

public static final @NonNull File DataStoreFile.dataStoreFile(
    @NonNull Context receiver,
    @NonNull String fileName
)

Generate the File object for DataStore based on the provided context and name. the file is generated by calling File(context.applicationContext.filesDir, "datastore/$fileName"). This is public to allow for testing and backwards compatibility (e.g. if moving from the dataStore delegate or context.createDataStore to DataStoreFactory).

Do NOT use the file outside of DataStore.

the context of the application used to get the files directory

the file name