Android Tutorial #8: DataStore — Replace SharedPreferences

SharedPreferences has been the go-to way to store simple data on Android for over a decade. It works. But it has problems. It runs on the main thread and can cause jank. It has no type safety — you request a string and get a crash if the key holds an integer. It has no way to observe changes reactively. And it does not handle errors — a corrupted file means lost data with no recovery. ...

July 6, 2026 · 8 min

KMP Tutorial #8: DataStore — Key-Value Storage in Kotlin Multiplatform

In the previous tutorial, we used SQLDelight for structured data — tables with rows and columns. But not everything belongs in a database. Simple settings like “dark mode on/off”, “last selected tab”, or “auth token” need something lighter. That is what DataStore does. It is Google’s replacement for SharedPreferences, and it works on Android, iOS, and Desktop through KMP. What is DataStore? DataStore is a key-value storage library. Think of it like a dictionary: ...

April 3, 2026 · 8 min