O Google tem o compromisso de promover a igualdade racial para as comunidades negras. Saiba como.

androidx.datastore

Extension functions summary

For android.content.Context
DataStore<T>
Context.createDataStore(fileName: String, serializer: Serializer<T>, corruptionHandler: ReplaceFileCorruptionHandler<T>? = null, migrations: List<DataMigration<T>> = listOf(), scope: CoroutineScope = CoroutineScope(Dispatchers.IO + SupervisorJob()))

Create an instance of SingleProcessDataStore.

Extension functions

createDataStore

fun <T> Context.createDataStore(
    fileName: String,
    serializer: Serializer<T>,
    corruptionHandler: ReplaceFileCorruptionHandler<T>? = null,
    migrations: List<DataMigration<T>> = listOf(),
    scope: CoroutineScope = CoroutineScope(Dispatchers.IO + SupervisorJob())
): 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. Note: this function is not comparable to Context.getSharedPreferences; this function creates and returns a new instance of DataStore each time it is called.

Parameters
fileName: String the filename relative to Context.filesDir that DataStore acts on. The File is obtained by calling File(context.filesDir, "datastore/$fileName")). No two instances of DataStore should act on the same file at the same time.
corruptionHandler: ReplaceFileCorruptionHandler<T>? = null The corruptionHandler is invoked if DataStore encounters a androidx.datastore.CorruptionException when attempting to read data. CorruptionExceptions are thrown by serializers when data can not be de-serialized.
migrations: List<DataMigration<T>> = 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.
Return
a new DataStore instance with the provided configuration