includeIfNull property Null safety

bool? includeIfNull

Whether the generator should include fields with null values in the serialized output.

If true, the generator should include the field in the serialized output, even if the value is null.

The default value, null, indicates that the behavior should be acquired from the JsonSerializable.includeIfNull annotation on the enclosing class.

If disallowNullValue is true, this value is treated as false to ensure compatibility between toJson and fromJson.

If both includeIfNull and disallowNullValue are set to true on the same field, an exception will be thrown during code generation.


final bool? includeIfNull;