A simple implementation of the Android SharedPreferences interface for DataStore.
You can use the synchronous and asynchronous methods of this library like in the instance generated by
Note: If you need to support large or complex datasets, partial updates, or referential integrity, consider using Room instead of DataStore. DataStore is ideal for small, simple datasets and does not support partial updates or referential integrity.
Simply copy the source code of the file DataStorePreferences.kt into your project to use it.
And don’t forget to add the “androidx.datastore:datastore-preferences” dependency to your build.gradle file.
I’ll upload the library to MavenCentral later if needed.