entity_mapper 0.2.0  entity_mapper: ^0.2.0 copied to clipboard
entity_mapper: ^0.2.0 copied to clipboard
Lightweight code generator for Clean Architecture focused projects. Automatically creates type-safe Entity ↔ Model mapping methods with dart_mappable-style patterns.
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.2.0 - 2025-08-13 #
Changed #
- BREAKING: Removed toModel()instance method from generated mixin for cleaner API semantics
- Entity → Model conversion now only available via static {Entity}EntityMapper.toModel(entity)method
- Improved API clarity by removing semantically incorrect method
Fixed #
- Eliminated confusing API where model instances could convert entities to models
- Better separation of concerns: static methods for entity→model, instance methods for model→entity
Why This Change #
The toModel() instance method on the mixin was semantically incorrect and confusing:
- Calling userModel.toModel(entity)didn't make logical sense
- It created ambiguity in the API
- No real-world use case existed for this pattern
Migration: Replace model.toModel(entity) with EntityMapper.toModel(entity)
0.1.0 - 2025-08-13 #
Added #
- Initial release of Entity Mapper package
- @MapToEntityannotation for marking classes for entity mapping generation
- @EntityFieldannotation for custom field mapping configuration
- Automatic code generation for entity-to-model and model-to-entity mapping
- Static mapper classes with toModelandtoEntitymethods
- Mixin support for instance methods on models
- Support for custom field mappings and transformations
- Support for ignoring specific fields during mapping
- Comprehensive test suite with integration and functional tests
- Complete documentation with usage examples
- Clean Architecture pattern support
- Flutter and Dart compatibility
Features #
- Code Generation: Automatically generates mapping code at build time
- Type Safety: Generated code is fully type-safe
- Zero Runtime Overhead: All mapping logic is generated at compile time
- Flexible Configuration: Customizable field mappings and transformations
- Clean API: Simple annotations with intuitive usage
- Comprehensive Testing: Extensive test coverage for reliability
Documentation #
- Complete README with installation and usage instructions
- API documentation for all annotations and features
- Real-world examples and best practices