shouldEncodeElementDefault
Whether the format should encode values that are equal to the default values. This method is used by plugin-generated serializers for properties with default values:
@Serializable
class WithDefault(val int: Int = 42)
// serialize method
if (value.int != 42 || output.shouldEncodeElementDefault(serialDesc, 0)) {
encoder.encodeIntElement(serialDesc, 0, value.int);
}
Content copied to clipboard
This method is never invoked for properties annotated with EncodeDefault.