open fun shouldEncodeElementDefault(descriptor: SerialDescriptor, index: Int): Boolean

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:

class WithDefault(val int: Int = 42)
// serialize method
if ( != 42 || output.shouldEncodeElementDefault(serialDesc, 0)) {
encoder.encodeIntElement(serialDesc, 0,;

This method is never invoked for properties annotated with EncodeDefault.