zorphy 1.9.0
zorphy: ^1.9.0 copied to clipboard
A powerful code generation package for Dart/Flutter that provides clean class definitions with copyWith, JSON serialization, toString, equality, and inheritance support
1.9.0 - 2026-07-21 #
Breaking #
- Replaced inline
_zc/ZorphyJsonHelpersafe-cast approach with nativejson_serializabledeserialization usingchecked: true— field-level error messages are now provided byCheckedFromJsonExceptionfrom thejson_serializablepackage rather than customZorphyJsonCastError - Removed
zorphy_annotationsource files:json_helper.dartandjson_cast_error.dart— these are no longer needed; all JSON deserialization is handled byjson_serializabledirectly
Fix #
Map<K, V>fields (e.g.Map<String, String>?,Map<String, Entity>?) now correctly deserialize becausechecked: true+ native generation produces recursive.map((k, e) => MapEntry(k, e as String))conversions in the.g.dartfile, resolving runtimetype '_Map<String, dynamic>' is not a subtype of type 'Map<String, String>'errors
Chore #
- Upgraded
build_runnerto ^2.15.2,source_gento ^4.2.3,json_annotationto ^4.12.0 - Removed
dependency_overridesforanalyzerandmeta— packages now resolve coherently against the SDK
Features preserved from earlier releases (cherry-picked) #
- Refined nullable-string property helpers:
text?.isNotEmpty == trueinstead oftext != null && text.isNotEmpty - Const constructor support for non-sealed abstract classes
1.8.10 - 2026-07-21 #
Fix #
- Replaced deprecated
@JsonKey(ignore: true)with@JsonKey(includeToJson: false, includeFromJson: false)onhashCodegetter Map<K,V>fields now use direct(json['f'] as Map<K,V>?)cast instead ofZorphyJsonHelper.castto avoid runtime type erasure issues (e.g.Map<String, dynamic>vsMap<String, String>)
1.8.9 - 2026-07-21 #
Fix #
- Replaced deprecated
@JsonKey(ignore: true)with@JsonKey(includeToJson: false, includeFromJson: false)onhashCodegetter
1.8.8 - 2026-07-21 #
Fix #
hashCodegetter is now annotated with@JsonKey(ignore: true)to prevent json_serializable from including it intoJsonoutput (regression fromcreateFactory: falsechanges)
1.8.7 - 2026-07-21 #
Fix #
List<Object>and other identity-cast list fields now cast directly to the target type (as List<Object>?) instead of going throughList<dynamic>which isn't assignable in Dart 3- Fields like
List<Object>? get matchnow generate(json['match'] as List<Object>?)
1.8.6 - 2026-07-20 #
Fix #
- Reverted
List/Setfield casts fromZorphyJsonHelper.cast<List<dynamic>>back to(json['f'] as List<dynamic>)— generic function return types don't satisfy Dart 3's type system for downstream typed list parameters - Enum detection now scans analyzer-level type arguments, catching enums that only appear inside generic types like
List<TransformationType>without a bareTransformationTypefield
1.8.5 - 2026-07-20 #
Fix #
List<EnumType>fields in fromJson now use$enumDecode(_$EnumTypeEnumMap, e)for element conversion instead of incorrectly callingEnumType.fromJson(e as Map<String, dynamic>)
1.8.4 - 2026-07-20 #
Fix #
- Fields with
@JsonKey(fromJson: someConverter)but noincludeFromJson: falsenow correctly call the converter instead of falling through to.fromJson()on the raw type
1.8.3 - 2026-07-20 #
Fix #
- Non-sealed abstract classes with
constconstructors now correctly generateconst ClassName();instead ofClassName();
1.8.2 - 2026-07-20 #
1.8.1 - 2026-07-20 #
Fix #
- Replaced per-class
_zc<T>()static helpers with sharedZorphyJsonHelper.cast<T>()fromzorphy_annotationfor Dart 3.12+ compatibility - Added
ZorphyJsonCastErrorwith field-level context in error messages
1.8.0 - 2026-07-20 #
Feature #
- Safe fromJson casts with field-level error messages — replaces json_serializable delegates with inline
_zc<T>()wrapper that throwsTypeError.withStackTraceincluding field name, expected type, actual type, and the value itself - Example error:
Zorphy: Field 'id' expected String, got int (42)
1.6.9 - 2026-04-27 #
Change #
- Revert property helper generation to ownFields and fix automated publishing flow
1.6.8 - 2026-04-27 #
Change #
- Streamline release process and fix PropertyHelpers extension generation for inherited fields
1.6.7 - 2026-04-06 #
Fix #
- Factory method parameter types now preserve import prefixes (
asclauses) in generated code
1.6.6 - 2026-04-05 #
Feature #
- Extracted Patch class boilerplate into
PatchBaseto drastically reduce generated code size. - Fixed
toJson()bug on abstract base classes in explicit subtypeschangeToextension.
1.6.1 - 2026-02-15 #
Change #
- Refactored CLI code to be more robust and consumable
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.
1.5.7 - 2026-02-14 #
Fix #
- Modified skip logic in
getProperties()to not skip fields that exist in both parentFields and ownFields (overridden fields) - Prevents duplicate
@overrideannotation when source already has it - Constructor generation
isParentFieldcheck now excludes fields in ownFields so overridden fields usethis.fieldsyntax - Added
_getCovariantFields()helper to detect fields where class type differs from interface type getInterfaceCopyWithMethods()now uses class field types (not interface types) for parameters and adds covariant where neededgetInterfaceCopyWithFnMethods()now uses class field types for parameters
1.5.6 - 2026-02-14 #
Chore #
- Updated docs and created docusaurus website
- Create public constructors by default and only create private when hidden
1.5.4 - 2026-02-13 #
Change #
- Allow hybrid serialization with json_serializable for generic field types
1.5.3 - 2026-02-13 #
Fix #
- Fixed JsonKey and other annotations not being caught due to Analyzer 10 changes
1.5.2 - 2026-02-12 #
Fix #
- Updated copyWith generation to use a sentinel parameter pattern, preserving non-nullable fields while allowing explicit nulls for nullable fields
1.1.0 - 2026-02-05 #
Change #
- Fixed edge case where a class extends a sealed class and implements another class causing parameters not passed in super constructor
1.0.0 - 2026-02-04 #
Added #
- Initial release of zorphy_annotation package
- Core
@Zorphy()annotation with full configuration support generateJsonoption for JSON serializationgenerateCompareTooption for diff generationgenerateCopyWithFnoption for function-based copyWithexplicitSubTypesoption for sealed class hierarchies- Support for generic type parameters
- Support for nested object patching
- Support for self-referencing types
- Support for multiple inheritance via interfaces
- Support for enum fields
- Support for constant constructors
- Full TypeScript-style type safety
Features #
- Immutable data class generation
- Automatic constructor generation
- Smart copyWith methods
- Advanced patching system with fluent API
- JSON serialization with lean JSON option
- Sealed classes with polymorphic serialization
- Multiple inheritance support
- Generic class support
- Enum integration
- Self-referencing type support
- Comparison and diff generation
- Equality and hashCode generation
- ToString generation
- Type-safe field enums
Documentation #
- Comprehensive README with examples
- Quick start guide
- Feature reference
- Real-world usage examples