Files
coco 723ce1af5c a
2026-07-03 15:12:48 +08:00

14 lines
834 B
Markdown

# DataStore-sample
DataStore-sample
- Preferences DataStore [Working with Preferences DataStore Codelab](https://developer.android.com/codelabs/android-preferences-datastore#0).
- Using [Jetpack Compose](https://developer.android.com/jetpack/compose) for UI.
- Toggle dark mode / light mode.
- StateFlow, Coroutines Flow.
> DataStore is a new and improved data storage solution aimed at replacing SharedPreferences. Built on Kotlin coroutines and Flow, DataStore provides two different implementations: Proto DataStore, that lets you store typed objects (backed by protocol buffers) and Preferences DataStore, that stores key-value pairs. Data is stored asynchronously, consistently, and transactionally, overcoming some of the drawbacks of SharedPreferences.
<p align="center">
<img src="demo.gif" height="480" >
</p>