I am try to store a list of object with data store...
# android
j
I am try to store a list of object with data store but I am getting this error:
Copy code
kotlinx.serialization.SerializationException: Class 'SmallPersistentVector' is not registered for polymorphic serialization in the scope of 'PersistentList'.
    Mark the base class as 'sealed' or register the serializer explicitly.
this is the data class:
Copy code
@Serializable
data class Ngo(
    val data: PersistentList<NgoData> = persistentListOf()
)

@Serializable
class NgoData(
    var companyId: Int,
    var country: String,
    var createdAt: String,
    var gallery: Gallery,
    var id: String,
    var mission: String,
    var name: String,
    var organisationType: String,
    var picture: String,
    var pictureUrl: String,
    var points: String,
    var text: String,
    var updatedAt: String
)

@Serializable
data class Gallery(
    var gallery: List<String>
)
j
@Joe Altidore the problem is probably connected with the base class of
PersistentList
see https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/polymorphism.md#designing-serializable-hierarchy for more about polymorphic serialization, base class probably is not serializable, but that’s just a raw quess. In the link I pasted above docks seem to tackle similar problem
197 Views