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
Zach Klippenstein (he/him) [MOD]
12/15/2021, 7:04 PM
If your type isn’t bundleable, you need a custom saver
d
Dragos Rachieru
12/16/2021, 10:59 AM
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
Zach Klippenstein (he/him) [MOD]
12/16/2021, 2:55 PM
I thought that was fixed quite a while ago, but I haven’t tried it recently so not sure.
Zach Klippenstein (he/him) [MOD]
12/16/2021, 2:57 PM
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