I am attempting to setup a polymorphic object that will be contained within another object. Serialization and saving to the database is working as intended, but fetching and deserializing from the server is throwing a Serialization Exception.
The object is setup as follows:
@Serializable
data class Job(
val appointments: List<Appointment>,
)
@Serializable
@FirebaseClassDiscriminator("Type")
sealed class Appointment {
@Serializable
@SerialName("Sales")
data class Sales(
) : Appointment()
@Serializable
@SerialName("Service")
data class Service(
) : Appointment()
}
I am attempting to setup a polymorphic object that will be contained within another object. Serialization and saving to the database is working as intended, but fetching and deserializing from the server is throwing a Serialization Exception.
The object is setup as follows: