json_extension_type 1.2.0 copy "json_extension_type: ^1.2.0" to clipboard
json_extension_type: ^1.2.0 copied to clipboard

JSON Extension Type Generator - Automatically generates extension types for JSON to Dart typedef records and classes conversion.

Changelog #

All notable changes to this project will be documented in this file.

1.2.0 - 2025-10-25 #

Added #

  • Complete Examples: Added 4 runnable Dart examples in /example directory
    • basic_example.dart - Simple typedef records and basic conversions
    • nested_types_example.dart - Complex nested structures
    • custom_annotations_example.dart - Using #key and #default annotations
    • api_simulation_example.dart - Real-world API integration patterns
  • Package Logo: Added professional SVG logo for branding
    • Full size logo (assets/logo.svg)
    • Small logo variant (assets/logo_small.svg)
  • Enhanced README:
    • Added logo and badges
    • Improved visual presentation
    • Added examples section with direct links
    • Better documentation structure
  • Example Documentation: Added comprehensive example/README.md with learning path

Changed #

  • Class Support Note: Marked class support as experimental (๐Ÿงช) in documentation
  • pubspec.yaml: Added documentation link and screenshots configuration

1.1.1 - 2025-10-25 #

Fixed #

  • Duplicate extension generation: Fixed issue where running jet generate multiple times would create duplicate extension types for classes
  • Improved _removeOldExtensions function to properly detect and remove previously generated code using the "Generated by JET" marker
  • Added fallback detection for both typedefs and classes to ensure clean regeneration

1.1.0 - 2025-10-25 #

Added #

  • Class support: Generate extensions for Dart classes with constructors
  • Automatic detection of class fields
  • Smart constructor parsing (ignores constructors and methods, only parses fields)
  • Works with both typedef records and classes in the same file
  • Generated code comments: Each extension now includes a header comment indicating it's auto-generated

Improved #

  • Better parsing algorithm using brace counting for classes
  • More robust field detection
  • Clear warnings not to modify generated code manually

1.0.0 - 2025-10-25 #

Added #

  • Initial release of JSON Extension Type Generator
  • CLI tool with jet command
  • Automatic generation of extension types for typedef records
  • Support for primitive types (String, int, double, bool)
  • Support for nullable types
  • Support for List
  • Support for Enums with automatic string conversion
  • Support for custom/nested record types
  • Custom annotations support:
    • #key:name - Customize JSON key mapping
    • #default:value - Set custom default values
  • Automatic detection of enums and their first values
  • Regeneration support (removes old extensions before generating new ones)
  • Pretty output with emojis for better UX
  • Comprehensive documentation and examples

Features #

  • Primitive Types: Full support for Dart primitive types with appropriate defaults
  • Type Safety: Generated code is fully type-safe
  • Null Safety: Proper handling of nullable types
  • Lists: Support for both primitive and custom type lists
  • Enums: Automatic conversion from string to enum values
  • Nested Types: Support for deeply nested record types
  • Annotations: Flexible annotation system for customization
  • CLI: User-friendly command-line interface
  • Automatic Updates: Re-running generator updates existing extensions

Commands #

  • jet generate [path] - Generate extensions for models in specified directory
  • jet help - Show help information
  • jet --version - Show version information

Project Structure #

  • bin/jet.dart - CLI entry point
  • lib/generator.dart - Main generator logic
  • lib/parser.dart - Model parsing utilities
  • lib/code_generator.dart - Code generation logic
  • lib/models.dart - Internal data models

Dependencies #

  • args: ^2.7.0 - Command-line argument parsing
  • path: ^1.9.0 - Path manipulation utilities

Documentation #

  • Comprehensive README with examples
  • Usage guide with all features explained
  • Type support documentation
  • Custom annotations guide
  • CLI options reference

[Unreleased] #

Planned Features #

  • Watch mode for automatic regeneration on file changes
  • Configuration file support (jet.yaml)
  • Custom templates for generated code
  • Support for Map<String, dynamic>
  • Validation rules support
  • JSON serialization (toJson methods)
  • More annotation options (#ignore, #required, etc.)
  • Better error messages and debugging
  • Test generation
  • Integration with build_runner
0
likes
140
points
8
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

JSON Extension Type Generator - Automatically generates extension types for JSON to Dart typedef records and classes conversion.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

args, path

More

Packages that depend on json_extension_type