omni_mapper_generator 0.5.2 copy "omni_mapper_generator: ^0.5.2" to clipboard
omni_mapper_generator: ^0.5.2 copied to clipboard

A powerful code generator that automates boilerplate mapping conversions using the omni_mapper annotations.

OmniMapper Generator #

pub package License

Code generator for the omni_mapper package.

This package automatically generates type-safe object-to-object mapping code, eliminating boilerplate for converting between DTOs, Models, Entities, and ViewModels.

Installation #

Add this package as a dev_dependency alongside build_runner, and add omni_mapper to your normal dependencies:

dependencies:
  omni_mapper: ^0.1.0

dev_dependencies:
  build_runner: ^2.4.0
  omni_mapper_generator: ^0.1.0

Features #

  • Extension-based mapping — generates clean extension methods on your classes
  • Bidirectional mapping — use target (Model → Entity) or from (Entity → Model)
  • Custom field mapping — rename fields between source and target
  • Type converters — handle type mismatches with OmniConverter
  • Default values — provide fallbacks for missing fields
  • List generation — batch-map iterables automatically
  • In-place updates — mutate existing objects without creating new ones
  • Multi-mapper — map a single class to multiple targets with @OmniMappers
  • @OmniField Annotation — fine-grained field-level configuration directly on class properties
  • Multiple Sources Mapping — combine multiple source objects into a single target object
  • Polymorphic Mapping — handle subclasses and inheritance dynamically (@SubclassMapping)
  • Dependency Injection & Composition — reference existing injectable mappers (uses: [OtherMapper])
  • Custom Field Expressions — pure Dart code passed as a string (MappingRule.custom)
  • Full Freezed/BuiltValue Compatibility — flawless support for Factory Constructors
  • Automatic Enum Mapping — map enums by matching names automatically
  • Deep Auto-Flattening — map nested objects automatically
  • Strict Mode & IgnoreIfNull — enforce complete mappings and support PATCH-like object updates

Usage #

For detailed usage instructions and examples, please refer to the omni_mapper package documentation.

Running the Generator #

# One-time build
dart run build_runner build -d

# Watch mode
dart run build_runner watch -d

License #

This project is licensed under the BSD 3-Clause License — see the LICENSE file for details.

1
likes
160
points
133
downloads

Documentation

API reference

Publisher

verified publishermveloso.dev

Weekly Downloads

A powerful code generator that automates boilerplate mapping conversions using the omni_mapper annotations.

Repository (GitHub)
View/report issues

Topics

#mapper #code-generation #build-runner #source-gen

License

BSD-3-Clause (license)

Dependencies

analyzer, build, code_builder, dart_style, omni_mapper, source_gen

More

Packages that depend on omni_mapper_generator