JsonKey class
Customizes JSON serialization for a specific field.
@Model()
class User {
@JsonKey(name: 'user_id')
final int id;
@JsonKey(ignore: true)
final String cache;
}
Constructors
Properties
- convention → NamingConvention?
-
Field-level naming convention override
final
- defaultValue → String?
-
Default value expression (as string)
final
- fromJson → String?
-
Custom fromJson function name
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- ignore → bool
-
Skip this field during serialization
final
- includeIfNull → bool
-
Include field in JSON even when null
final
- name → String?
-
Custom JSON key name
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- toJson → String?
-
Custom toJson function name
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