safe_json_serializable 0.3.0
safe_json_serializable: ^0.3.0 copied to clipboard
Crash-safe drop-in for json_serializable: runs its generator with tolerant TypeHelpers so backend type changes never crash fromJson. No fork, no per-field annotations.
0.3.0 #
- Behaviour change: a non-nullable
Listwith no@JsonKey(defaultValue:)now falls back to an empty list instead of throwing. The empty list is the type's own neutral value, so it invents no data — unlike a scalar, where0or''would be a made-up answer. Elements keep their existing rules: a bad element becomesnullin aList<T?>, and still fails loud in aList<T>. - A non-nullable nested model with a non-object value now reports a
FormatExceptionviafailParseinstead of lettingasStringMapthrow a bareas MapTypeError. Same fail-fast semantics, readable error.
0.2.1 #
- Raise the SDK constraint to
^3.9.0to matchjson_serializable^6.14.0 andjson_annotation^4.12.0, which already require it. No code changes.
0.2.0 #
- Support json_serializable options
0.1.0 #
- Initial release.
- Crash-safe fromJson for json_serializable via custom TypeHelpers, with no fork and no per-field annotations.
- Tolerant parsing for int, double, num, String, bool, DateTime, nested models and lists (incl. list/collection elements).
- Nullable fields become null on bad data; non-null fields coerce when possible and otherwise fail fast, unless @JsonKey(defaultValue:) provides a fallback.