EricLog
Published in

EricLog

Jetpack DataStore 搭配 kotlinx.serialization Protobuf

A harddisk

上月 kotlinx.serialization 出了 1.0 版。除了支援 JSON 之外,還有支援 Protocol Buffers (Protobuf),而且還是跨平台支援。而在前一個月 Android 出了 Jetpack DataStore,它是一個用來取代 SharedPreferences 的 library。它有兩種用法:

  1. Preferences DataStore:像 SharedPreferences 般以 key 存取資料,可以隨時加新 key,而且沒有特別的 type checking 處理,全靠讀取時指明 value 的 data type。
  2. Proto DataStore:用 Protobuf 來儲存資料,存取時候都是直接經 Java/Kotlin class,所以和…

--

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Eric Li

Eric Li

Hongkonger + Android developer

More from Medium

Adding a new target to your KMP project: hello watchOS

Android 102 : Why does dagger generate MembersInjector for us?

Mustache, rendering and localitazion email in Kotlin

Making Stop watch using compose Desktop