Package-level declarations
Functions
Link copied to clipboard
fun <T> dataStore( fileName: String, serializer: Serializer<T>, corruptionHandler: ReplaceFileCorruptionHandler<T>? = null, produceMigrations: (Context) -> List<DataMigration<T>> = { listOf() }, scope: CoroutineScope = CoroutineScope(Dispatchers.IO + SupervisorJob())): ReadOnlyProperty<Context, DataStore<T>>
Creates a property delegate for a single process DataStore. This should only be called once in a file (at the top level), and all usages of the DataStore should use a reference the same Instance. The receiver type for the property delegate must be an instance of Context.
Link copied to clipboard
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).