DataStoreFactory

expect object DataStoreFactory(source)
actual object DataStoreFactory(source)

Public factory for creating DataStore instances.

actual object DataStoreFactory(source)

Public factory for creating DataStore instances.

Functions

Link copied to clipboard
expect fun <T> create(    storage: Storage<T>,     corruptionHandler: ReplaceFileCorruptionHandler<T>? = null,     migrations: List<DataMigration<T>> = listOf(),     scope: CoroutineScope = CoroutineScope(ioDispatcher() + SupervisorJob())): DataStore<T>
actual fun <T> create(    storage: Storage<T>,     corruptionHandler: ReplaceFileCorruptionHandler<T>?,     migrations: List<DataMigration<T>>,     scope: CoroutineScope): DataStore<T>
fun <T> create(    serializer: Serializer<T>,     corruptionHandler: ReplaceFileCorruptionHandler<T>? = null,     migrations: List<DataMigration<T>> = listOf(),     scope: CoroutineScope = CoroutineScope(Dispatchers.IO + SupervisorJob()),     produceFile: () -> File): DataStore<T>

Create an instance of SingleProcessDataStore. Never create more than one instance of DataStore for a given file; doing so can break all DataStore functionality. You should consider managing your DataStore instance as a singleton. If there are multiple DataStores active, DataStore will throw IllegalStateException when reading or updating data. A DataStore is considered active as long as its scope is active.

actual fun <T> create(    storage: Storage<T>,     corruptionHandler: ReplaceFileCorruptionHandler<T>?,     migrations: List<DataMigration<T>>,     scope: CoroutineScope): DataStore<T>

Create an instance of SingleProcessDataStore. Never create more than one instance of DataStore for a given file; doing so can break all DataStore functionality. You should consider managing your DataStore instance as a singleton. If there are multiple DataStores active, DataStore will throw IllegalStateException when reading or updating data. A DataStore is considered active as long as its scope is active.