encodeEmptyCollection property

bool encodeEmptyCollection
@Deprecated('Will be removed in 3.0.0.'), final

Whether the generator should include the annotated field value in the serialized output if it is empty.

If true (the default), empty values are included in the generated toJson function.

If false, fields with empty collections are omitted from toJson.

Note: setting this property to false overrides the includeIfNull value to false as well. Explicitly setting includeIfNull to true and setting this property to false will cause an error at build time.

Note: setting this property to false on a non-collection field (of types other than Iterable, Set, List, and Map) will cause an error at build time.

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

Implementation

final bool encodeEmptyCollection