JsonInclude class
Decides which values of a property, or of every property of a class,
are written: for example, leave out nulls.
Use it to keep responses small or to send partial updates, where a
missing property means "unchanged". It wins over the mapper's
inclusion (spring.json.default-property-inclusion; Spring
Boot: spring.jackson.default-property-inclusion); on a property it
wins over the class's.
// A partial update: only the fields that were set are sent.
@Introspected()
@JsonInclude(JsonInclusion.nonNull)
class Patch { String? title; String? note; }
// Patch()..title = 'x' → {"title": "x"}
Spring (Java):
@JsonInclude(JsonInclude.Include.NON_NULL)
class Patch { ... }
Constructors
- JsonInclude(JsonInclusion value)
-
Writes the values
valuelets through.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
- value → JsonInclusion
-
Which values are written.
final
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