JsonAnySetter class
Collects the JSON properties a class does not have, instead of skipping them or failing.
Put it on a Map<String, ...> property or on a method taking
(String name, value). With it, unknown properties never fail, even
with failOnUnknownProperties on. A map property that is a constructor
parameter receives them as its argument; otherwise its map is filled
(or created when it is null). Values are read as the map's value
type.
// Every unknown property ends up in `extra`.
@JsonAnySetter()
void set(String name, Object? value) => extra[name] = value;
Spring (Java):
@JsonAnySetter
void set(String name, Object value) { extra.put(name, value); }
Constructors
- JsonAnySetter()
-
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