DataStore
DataStore provides a safe and durable way to store small amounts of data, such as preferences and application state. It does not support partial updates: if any field is modified, the whole object will be serialized and persisted to disk. If you want partial updates, consider the Room API (SQLite).
DataStore provides ACID guarantees. It is thread-safe, and non-blocking. In particular, it addresses these design shortcomings of the SharedPreferences API:
Synchronous API encourages StrictMode violations
apply() and commit() have no mechanism of signalling errors
apply() will block the UI thread on fsync()
Not durable – it can returns state that is not yet persisted
No consistency or transactional semantics
Throws runtime exception on parsing errors
Exposes mutable references to its internal state