Tomas Kormanak
03/30/2022, 9:34 AM@Seriazlizable
annotation constructor can not have parameter which is not property
@Serializable
class Document(
name: String,
) {
var name: String = name
private set
}
Stephan Schroeder
03/30/2022, 3:04 PMKlitos Kyriacou
03/30/2022, 3:09 PMephemient
03/30/2022, 4:58 PM@Serializable
class Document(
@SerialName("name")
private var _name: String,
) {
val name: String
get() = _name
}
@Serializable
class Document private constructor(
) {
constructor(
name: String,
) : this(
) {
this.name = name
}
var name: String = ""
private set
but unfortunately both do have some effect on the public API of your class