smart_mapper_generator
Source generator for the
smart_mapper annotations package.
It generates constructor-based mappings for Clean Architecture boundaries:
Remote DTO -> Local Model -> Domain Entity
Setup
Add it as a dev dependency, annotate an abstract mapper, then run:
dependencies:
smart_mapper: ^0.1.0
dev_dependencies:
build_runner: ^2.16.0
smart_mapper_generator: ^0.1.0
dart run build_runner build
Application code should import package:smart_mapper/smart_mapper.dart, not
this package directly.
Supported mappings
- Same-name constructor fields
- Explicit field renames with
@MapField - Freezed factory constructors
- Nested
ListandIterablemappings - ObjectBox
ToManyrelation population - Compile-time errors for missing or ambiguous item mappers
See the smart_mapper usage guide
for mapper declarations and generated-code examples.