smart_mapper_generator 0.2.0 copy "smart_mapper_generator: ^0.2.0" to clipboard
smart_mapper_generator: ^0.2.0 copied to clipboard

Source generator for smart_mapper, including nested collections and ObjectBox ToMany relations.

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.2.0

dev_dependencies:
  build_runner: ^2.16.0
  smart_mapper_generator: ^0.2.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
  • Strict analyzer-based type validation
  • Explicit field renames and converters with @MapField
  • Explicit ObjectBox relations with @MapRelation
  • Ignored targets and constant defaults
  • Named constructors
  • Freezed factory constructors
  • Nested List, Set, and Iterable mappings
  • Nullable collections and items
  • ObjectBox ToMany and ToOne relations
  • Compile-time errors for missing or ambiguous item mappers

See the smart_mapper usage guide for mapper declarations and generated-code examples.

0
likes
150
points
120
downloads

Documentation

API reference

Publisher

verified publisherpinz.dev

Weekly Downloads

Source generator for smart_mapper, including nested collections and ObjectBox ToMany relations.

Repository (GitHub)
View/report issues

Topics

#code-generation #clean-architecture #mapper #objectbox

License

MIT (license)

Dependencies

analyzer, build, smart_mapper, source_gen

More

Packages that depend on smart_mapper_generator