Hello, I am trying to use `rememberSaveable` on Desktop and Android, I have a sealed class that does...
d
Hello, I am trying to use
rememberSaveable
on Desktop and Android, I have a sealed class that doesn't extend
Serializable
or
Parcelable
, the code works fine on Desktop, but does not work on Android. How can I handle this? I was thinking of creating a custom saver for that, but serialization does not work with compose in the same module, so I'm trying to avoid that for now.
z
If your type isn’t bundleable, you need a custom saver
d
Is there a multiplatform saver to do this? Or an easy way to create a reusable
saver
, like
serialization
. I can use serialization for this, but I don't know if compose works with serialization in the same project now.
z
I thought that was fixed quite a while ago, but I haven’t tried it recently so not sure.
You could use any multiplatform serialization library to do it, but that might not be a good idea for performance reasons – android’s
Bundle
and
Parcelable
are designed and optimized to be used for this use case, other serialization libraries might do work too soon
👍🏻 1
196 Views