:eyes: <https://android-developers.googleblog.com/...
# confetti
b
s
I wonder what this means for the multiplatform-settings. Probably can just stop using that one in favor of just using datastore directly if you prefer that API I assume?
b
Good point! Last time I used DataStore, I wasn't a huge fan as you needed to use protobufs, and that was a bit of a headache šŸ˜…
But could be cool to have a look at the Multiplatform version of it
s
Yeah the protobuf alternative wasn’t that fun to work with in my opinion either. But you can definitely use the one that simply works as a key-value store, and if you want the type-safety, add a layer in-between where you send your stuff in as kotlinx.Serialization capable objects, and then store everything in the datastore as strings. It’s quite nice that way, since you get the type-safety, while also getting a good kotlin-friendly API that works on top of flows/suspending functions for everything.
b
Oh didn't think of using kotlinx serialization, that sounds good!
s
Yeah me neither, I first read this https://medium.com/androiddevelopers/datastore-and-kotlin-serialization-8b25bf0be66c and I was like: ā€œof course you can do that šŸ¤Æā€ You can do so much with this serialization library. In fact, there’s even a library that is a layer on top of the androidx.navigation library which uses the serialization library to give you nice type-safe destination building https://github.com/kiwicom/navigation-compose-typed. It uses the fact that the classes that are annotated with @Serializable can then be queried for their elements, how they are named, if they are nullable and so on. Also something I never would’ve thought of myself, but it works, and I’ve started using it in our work app recently with great success.
b
Very cool!