what do you guys use to persist data in compose mu...
# compose
f
what do you guys use to persist data in compose multiplatform? is there some library that does datastore on android, local storage on web, etc
k
c
You can find more in the link from Konstantin, but my go tos are: SQLDelight - SQLite database > SQLDelight generates typesafe kotlin APIs from your SQL statements. It verifies your schema, statements, and migrations at compile-time and provides IDE features like autocomplete and refactoring which make writing and maintaining SQL simple. and Multiplatform-Settings - Key-Value preferences > This is a Kotlin library for Multiplatform apps, so that common code can persist key-value data We also have Realm, if you are familiar with it Realm - NoSQL database > Realm is a mobile database that runs directly inside phones, tablets or wearables. This repository holds the source code for the Kotlin SDK for Realm, which runs on Kotlin Multiplatform and Android.
f
Thank you, I think multiplatform-settings is what i'm looking for
s
I'd go with androidx DataStore if you want a key-value store tbh
Konstantin, I see that repo does not accept issues, but I feel like Datastore is missing from the "Storage" section. If anything it's probably the one android devs should first consider because it's also the one they're most likely already using anyway
c
It’s about compose multiplatform and not Android
c
Great to learn about this, thank you Stylianos
🥳 1
k
the repo doesn't accept issues because there are PRs 😉
p
@Stylianos Gakis Doesnt support web though (ive seen some commits that suggest androidx wants to support wasmjs but still far from supporting room or datastore)
👍 2
f
no wasmJs in multiplatform-settings either 😕
c
What’s the issue with the JS target?
I find wasmJs not working in 50%+ of the existing browsers
p
@Fudge yep, the author said he was planning to add it (in some github branches you can see hes working on it) but still no eta for the wasm release
@Cicero wasm will work sooner rather than later (safari support is almost there). For my usecase, WASM desktop web, it works and its weird that the androidx team has not already implemented the js only target, if they want to support wasm its because maybe they know things...👀 idk
c
I mean, as a practical solution, for like, now? The JS target works. I would love to use wasm but the implementation is the same and, right now, Wasm, for a general USER problem, it does not work. Because people don’t use only the 2 most popular browsers. I’m just saying, go JS, don’t have the headache and as soon as wasm is ready, it’s a flip switch complexity to go wasm.
👍 1
946 Views