You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-1Lines changed: 22 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -106,7 +106,28 @@ data class Post(
106
106
107
107
This sdk will handle polymorphic serialization automatically if you have a sealed class and its children marked as `Serializable`. It will include a `type` property that will be used to discriminate which child class is the serialized.
108
108
109
-
You can change this `type` property by using the `@FirebaseClassDiscrminator` annotation in the parent sealed class.
109
+
You can change this `type` property by using the `@FirebaseClassDiscrminator` annotation in the parent sealed class:
110
+
111
+
```kotlin
112
+
@Serializable
113
+
@FirebaseClassDiscriminator("class")
114
+
sealedclassParent {
115
+
@Serializable
116
+
@SerialName("child")
117
+
data classChild(
118
+
valproperty:Boolean
119
+
) : Parent
120
+
}
121
+
```
122
+
123
+
In combination with a `SerialName` specified for the child class, you have full control over the serialized data. In this case it will be:
0 commit comments