JsonAnyGetter class

Writes the entries of a map property as extra properties of the object, after the declared ones.

Put it on a Map<String, ...> property or a method returning one. Use it for open-ended objects: known fields as properties, anything else kept in a map and written back flat. Pair it with JsonAnySetter to collect the unknown properties into the same map when reading, so they survive a read-modify-write round trip.

// Unknown properties are kept and written back.
@JsonAnyGetter()
@JsonAnySetter()
final Map<String, Object?> extra = {};

Spring (Java):

@JsonAnyGetter @JsonAnySetter Map<String, Object> extra = new HashMap<>();

Constructors

JsonAnyGetter()
Marks the map property or method.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited