Public factory for creating PreferenceDataStore instances.
Create an instance of SingleProcessDataStore.
produceFile: () -> File,
corruptionHandler: ReplaceFileCorruptionHandler<Preferences>? = null,
migrations: List<DataMigration<Preferences>> = listOf(),
scope: CoroutineScope = CoroutineScope(Dispatchers.IO + SupervisorJob())
Create an instance of SingleProcessDataStore. The user is responsible for ensuring that there is never more than one instance of SingleProcessDataStore acting on a file at a time.
|produceFile: () -> File||Function which returns the file that the new DataStore will act on. The function must return the same path every time. No two instances of PreferenceDataStore should act on the same file at the same time. The file must have the extension preferences_pb.|
|corruptionHandler: ReplaceFileCorruptionHandler<Preferences>? = null||The corruptionHandler is invoked if DataStore encounters a CorruptionException when attempting to read data. CorruptionExceptions are thrown by serializers when data cannot be de-serialized.|
|migrations: List<DataMigration<Preferences>> = listOf()||are run before any access to data can occur. Each producer and migration may be run more than once whether or not it already succeeded (potentially because another migration failed or a write to disk failed.)|
|scope: CoroutineScope = CoroutineScope(Dispatchers.IO + SupervisorJob())||The scope in which IO operations and transform functions will execute.|