entityfy_generator 3.0.2 copy "entityfy_generator: ^3.0.2" to clipboard
entityfy_generator: ^3.0.2 copied to clipboard

Code generator for creating extension methods to map model classes to entity classes using annotations.

Entityfy Generator #

Build-time code generator for the entityfy package. This dev dependency automatically generates complete Entity classes, UI Model classes, and their mapping methods using the @Entityfy annotation during build time.

Note: This is a development tool that runs during build time using build_runner. It does not add any runtime dependencies to your application.

Installation #

dependencies:
  entityfy: ^2.1.0

dev_dependencies:
  entityfy_generator: ^2.1.0
  build_runner: ^2.4.9

Features #

  • ๐ŸŽฏ Dual Class Generation: Generate both Entity and UI Model classes from a single source
  • ๐Ÿ“ Complete Class Creation: Auto-generates constructors, fromJson(), and toJson() methods
  • ๐Ÿ”„ Bidirectional Mapping: Creates both toEntity() and toUiModel() extension methods
  • โš™๏ธ Flexible Configuration: Configure what to generate with boolean flags
  • ๐Ÿ” Smart Type Conversion: Intelligent handling of nested models, lists, and primitive types
  • ๐Ÿ›ก๏ธ Type-Safe Mapping: Full compile-time type checking and validation
  • ๐Ÿ—๏ธ Combined Output: All code generated in a single .entityfy.g.dart file
  • ๐Ÿ“Š DateTime Support: Automatic ISO8601 DateTime serialization
  • ๐Ÿ”— Nested Model Support: Recursive conversion of annotated nested models
  • ๐Ÿงช Fake Data Generation: Static fakeList() methods for creating realistic test data (v2.1.0+)
  • ๐Ÿ“‹ CopyWith Methods: Immutable update methods with nullable parameters (v2.1.0+)
  • ๐ŸŽฏ Testing Support: Configurable mock data generation for development and testing (v2.1.0+)

Running the Generator #

# Generate code once
dart run build_runner build

# Watch for changes and rebuild automatically
dart run build_runner watch

# Clean previous builds
dart run build_runner clean
0
likes
150
points
60
downloads

Documentation

Documentation
API reference

Publisher

verified publishercposadadev.com

Weekly Downloads

Code generator for creating extension methods to map model classes to entity classes using annotations.

Repository (GitHub)
View/report issues

Topics

#code-generation #entity-mapping #data-transformation #annotations #source-gen

License

MIT (license)

Dependencies

analyzer, build, entityfy, source_gen

More

Packages that depend on entityfy_generator