Persistence on wasm target. :wave: hello, I was ...
# multiplatform
o
Persistence on wasm target. ๐Ÿ‘‹ hello, I was wondering ๐Ÿค” if there is a library that supports persistence across desktop,ios, android and wasm targets. I want to use sqldelight, in future, which still does not work with wasm. But in the meantime I would like to use some library at least to store REST responses persistently. Any recommendations? I will update once I find it.
a
Realm is a mobile database that supports object-oriented data modeling. It can be used to store complex data structures and relationships. Realm supports all of the platforms you mentioned, including WASM.
j
I don't believe Realm supports Wasm yet
o
I wanted to avoid Realm and also could not see the wasm support which is the main issue. I am really waiting for SQL delight to be working. So I need some simple solution in the meantime like a key value store. KStore library seems usable possibly with some wrapper around it for expect actual and using localStorage on Wasm.
๐Ÿ‘ 1
a
I see! If your need is to store a small amount of data, you can try Jetpack DataStore, which serves as a multiplatform persistent solution. For reference, you can view my solution in the following PR. I believe it also supports Wasm.
๐Ÿ‘ 1
o
Thanks for the code example! I guess I ll have to create quite some boilerplatte to make it work on wasm. But it seems this approach should work. I ll come back.
๐Ÿ™‡ 1
Thanks @Aslam Hossin for the suggestion, it worked out very well, lot of expect actual boilerplate for all platforms. And custom local storage implementation for wasm. I like it so much I will possibly follow the same approach to implement sql delight and use indexed db in the meantime.
๐Ÿ‘ 1