json_annotation_fs 0.1.0+1
json_annotation_fs: ^0.1.0+1 copied to clipboard
Safe JSON annotation package with error handling for Flutter/Dart. Extends json_annotation with robust parsing that prevents crashes on malformed or incomplete JSON data.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.1.0+1 2024-01-XX #
Added #
JsonSerializableFSannotation extendingJsonSerializablewith safe parsing- Safe parsers for primitive types:
SafeParseString/SafeParseStringNullableSafeParseInt/SafeParseIntNullableSafeParseDouble/SafeParseDoubleNullableSafeParseBool/SafeParseBoolNullableSafeParseDateTime/SafeParseDateTimeNullable
- Safe parsers for collections:
SafeParseStringList/SafeParseStringListNullableSafeParseIntList/SafeParseIntListNullableSafeParseDoubleList/SafeParseDoubleListNullableSafeParseBoolList/SafeParseBoolListNullable
- Support for custom object lists with
SafeParseCustomList/SafeParseCustomListNullable - Default field renaming to snake_case
- Comprehensive test suite covering all parsing scenarios
- Example project demonstrating usage patterns
- Full documentation in README.md
Features #
- Prevents crashes on malformed or incomplete JSON data
- Returns sensible default values for missing fields
- Type coercion for incompatible types (e.g., string to int)
- Nullable field support with explicit annotations
- Graceful error handling for all supported types