Reputation: 11
The annotation @PropertyName
is not serialized in Kotlin!
Version: com.google.firebase: firebase-firestore: 17.1.0
Using @PropertyName
in a Kotlin Android project, it does not serialize the value, only when I use annotation @JVMField
or create the same class in Java.
@JvmField
@PropertyName("championship-name")
val championshipName: String = "",
Upvotes: 1
Views: 1445
Reputation: 788
You can achieve this without making the property mutable, just annotate the getter with @PropertyName
:
@get:PropertyName("championship-name")
val championshipName: String = "",
Upvotes: 1
Reputation: 2538
Try like this
@get:PropertyName("championship-name") @set:PropertyName("championship-name") var championshipName: String = "",
Upvotes: 7