Skip to content
pubscout

auto_mappr_annotation

2.6.0, released 4 weeks ago by netglade.cz

Annotations for the auto_mappr code-generator to map between objects.

WASM-ready
$ flutter pub add auto_mappr_annotation
Source repository

What it does

Provides the @AutoMappr annotation and configuration options like MapType to define mapping rules between different objects. It works alongside a code generator to generate the mapping implementation automatically.

AI-written summary of version 2.6.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to map data transfer objects (DTOs) to domain models and vice versa.
  • You want declarative object-to-object mapping generated at build time.

Skip it when

  • You prefer manual mapping or runtime reflection-based mapping.
  • You are not using the companion auto_mappr code generator.

Strengths

  • Simplifies object mapping definition with annotations.
  • Supports custom constructors, type converters, and reverse mapping options.

Weaknesses

  • Requires a code generation step.
  • Only provides annotations; requires the separate auto_mappr package for generation logic.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0

Requires adding the package and setting up the companion auto_mappr code generator in your project.

import 'package:auto_mappr_annotation/auto_mappr_annotation.dart';

import 'main.auto_mappr.dart';

@AutoMappr([
  MapType<UserDto, User>(),
])
class Mappr extends $Mappr {}

Alternatives

Packages that do the same job and could replace auto_mappr_annotation.

Works with

Packages commonly used together with auto_mappr_annotation: ones it builds on, ones built on it, and its own family.