# PreferenceDataStoreFile

Added in 1.0.0

*** ** * ** ***

<br />

```
public final class PreferenceDataStoreFile
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/io/File.html` | `https://developer.android.com/reference/androidx/datastore/preferences/PreferenceDataStoreFile#(android.content.Context).preferencesDataStoreFile(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html name)` Generate the File object for Preferences DataStore based on the provided context and name. |

## Public methods

### preferencesDataStoreFile

Artifact: [androidx.datastore:datastore-preferences](https://developer.android.com/jetpack/androidx/releases/datastore) [View Source](https://cs.android.com/search?q=file:androidx/datastore/preferences/PreferenceDataStoreFile.android.kt+function:preferencesDataStoreFile) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/datastore#1.0.0)

```
public static final @NonNull File 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 `https://developer.android.com/reference/android/content/Context.html#filesDir` of `https://developer.android.com/reference/android/content/Context.html#applicationContext` for `this` + "datastore/" subdirectory with `https://developer.android.com/reference/androidx/datastore/preferences/package-summary#(android.content.Context).preferencesDataStoreFile(kotlin.String)`. 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