Open Source

auto_mappr

Code generation for Dart object mapping. Eliminates boilerplate DTO-to-model conversions with compile-time safety and zero runtime overhead.

Dart build_runner code gen

auto_mappr was born out of frustration with repetitive mapping code at Netglade. When you have dozens of DTOs and models, writing mapping functions by hand is error-prone and tedious.

How it works#

Define a mapper class with a single annotation:

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

Run build_runner, and auto_mappr generates the complete type-safe implementation. No reflection, no runtime overhead — just plain Dart code you can read and debug.

Why compile-time?#

Runtime reflection adds overhead and makes debugging harder. The generated code is transparent — you can open it, read it, and step through it in the debugger.

Features#

  • Nested object mapping
  • List and collection support
  • Nullable type handling
  • Custom converters
  • Default values