Best practice to omit optional parameter in a data class when its assigned null?
Example: data class xyz(val a:String ?,val b: String?, val c: String?= null)
if c = null, then data class xyz(val a:String ?,val b: String?).
Calling xyz.toString() which takes null as "null". So output is xyz("String for a", String for b", "null").
But actual output xyz("String for a", String for b").
Can I use secondary constructor or invoke() ? Which is better?
toString()? If the latter, how would you like to distinguish cases whencis null andbis null (assuming it is optional as well)? Both these cases would produce exactly same output. You can always implementtoString()by yourself.