Annotations¶
The dorm_annotations package
defines the metadata read by the dORM generator. Add annotations to abstract
Dart classes and getters, then regenerate the .dorm.dart and .g.dart
parts.
Note
An annotation declares names, fields, identities, or relationships. It does not open a connection or perform a database operation. Think of it as an instruction for the generator: it describes what a value means, while the generated entity and the selected engine use the resulting metadata at runtime.
Learn annotations in this order¶
Use the pages in this order when building a model from scratch:
Datafor reusable serializable values;Modelfor stored entities and their identities;@Fieldfor scalar and value fields;ModelFieldfor embedded data or models;ForeignFieldfor related identities;@DerivedFieldfor generated query values;@PolymorphicDatafor variant declarations;@PolymorphicFieldfor storing a selected variant.
The Quickstart applies these annotations to one continuous store application. Use these pages when you need the parameters, defaults, generated names, or boundaries of a specific annotation.
All annotated source files must declare the generated parts:
After changing an annotation, run:
The generated .dorm.dart file contains dORM entities, schema metadata,
repositories, the generated Dorm, and relationship paths. The .g.dart file
contains JSON helpers.