Macro catalogue
These are the macros that ship with dmx. They are not the limit of what it can generate: you can write your own in Dart as a custom macro.
Available now means dmx build generates it. The template is
built into dmx,
so installing dmx is all you need — there is nothing to copy into your project.
Defined means we have designed it and written its template, but dmx cannot
generate it yet. Annotating a class with one of these four does nothing and
leaves your file alone. Their templates sit beside the example showing the
output they are meant to produce, in
examples/storefront/templates/.
| Macro | Generates | Status |
|---|---|---|
@dmx('model') |
Immutable data-class members | Available now |
@dmx('union') |
Sealed sum types | Available now |
@dmx('enum') |
Wire-safe enums | Available now |
@dmx('diff') |
Changes represented as data | Available now |
@dmx('lerp') |
Composable interpolation | Available now |
@dmx('validate') |
Accumulating constraints | Available now |
@dmx('table') |
SQL schema and row mapping | Available now |
@dmx('route') |
Typed deep links | Available now |
@dmx('cli') |
Argument parsing and usage | Available now |
@dmx('fake') |
Deterministic fixtures | Available now |
@dmx('restClient') |
HTTP implementations | Available now |
@dmx('router') |
One matcher over routes | Defined |
@dmx('event') |
Analytics payloads | Defined |
@dmx('prefs') |
Typed settings | Defined |
@dmx('strings') |
Typed localisation | Defined |
The storefront example uses every macro on this page across one shop domain, so you can see how they fit together. Treat the Defined four as previews until dmx can generate them.
Start with the getting started guide, or try @dmx('model') in the
browser playground, where you can edit both the Dart and
the Mustache template.