Sharing my preference for DataStore
summary
DataStore claims to replace SharedPreferences and actually demonstrates that with concrete code: it uses Kotlin coroutines and Flow, provides Preferences (key‑value) and Proto (protocol buffers) implementations, and shows reads as Flows and writes as suspend atomic edits that guarantee on‑disk consistency. The talk shows migration code (shared‑prefs → preferences is trivial, → proto requires custom mapping and a done flag), error handling via IOException, and that proto gives compile‑time type safety.
AI-written summary · about
chapters (5)
- 0:00Start
- 1:32get the share preferences from the context
- 13:05implement a data migration
- 17:25use a user preference serializer
- 18:03set default values for our user preferences
related talks
30mDataStore Preferences and migrating from SharedPreferences
19mJetpack DataStore - protocol buffers storage solution
25mThe New Modern Data Persistence on Android - Meet Jetpack Datastore
26mSafely Migrating to DataStore in Production
34mStoring app data reliably & performantly with SimpleStore
29mKotlin State & Shared Flows in Action
24mLightweight Realtime & Offline Data Storage on Android without a Database
38mThe Dangers of SharedPreferences: An API allegory
