DataStore Preferences and migrating from SharedPreferences
summary
Explains migrating heavy SharedPreferences usage to Jetpack DataStore with concrete code: a app launch counter demo shows Preference DataStore using coroutines, Flow and Dispatchers.IO to read/write without blocking UI; a typed Proto DataStore example stores UI filters via a proto serializer and protobuf schema; migration uses SharedPreferencesMigration that runs once, maps old keys to proto fields, and deletes legacy files after success; demos show values persist and reads emit correctly.
AI-written summary · about
