SafeJsonField class
Annotation for individual fields to customize safe parsing behavior
Use this on specific fields to override default parsing behavior.
Example:
@JsonSerializable()
@SafeJsonParsing()
class User {
final int id;
@SafeJsonField(
description: 'User email address',
expectedFormat: 'user@example.com',
commonValues: ['test@example.com', 'admin@company.com'],
)
final String email;
@SafeJsonField(
customParser: '_parseUserStatus',
)
final UserStatus status;
}
Constructors
Properties
-
commonValues
→ List<
String> ? -
List of common/valid values for this field (helpful for debugging)
final
- customParser → String?
-
Name of a custom static parser method to use for this field
final
- description → String?
-
Human-readable description of what this field represents
final
- enhancedErrors → bool
-
Whether this field should use enhanced error reporting
final
- expectedFormat → String?
-
Expected format or example value for this field
final
- 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