<How to default null values on a data class?> I ha...
# forum
r
How to default null values on a data class? I have the following class with a default value for the property name. data class Location constructor( val lat: Double, val lon: Double, val name: String = "" ) Fine. If I call the constructor without passing a value for name, it initializes properly with the empty string but… Not fine, it gets called with the argument null by a deserialization framework (and maybe other frameworks). If I make the constructor parameter nullable and not a val, I can’t make it a data class so I...