Angel, like many other Web server frameworks, features support for object-relational mapping, or ORM. ORM tools allow for conversion from database results to Dart classes.
Angel's ORM uses Dart's build system to generate query builder classes from your Model classes, and takes advantage of Dart's strong typing to prevent errors at runtime.
Take, for example, the following class:
abstract class _Pokemon extends Model {
String get nickName;
int get level;
int get experiencePoints;
PokemonTrainer get trainer;
PokemonSpecies get species;
PokemonAttack get attack0;
PokemonAttack get attack2;
PokemonAttack get attack3;
PokemonAttack get attack4;
package:angel_orm_generator will generate code that lets you do the following:
app.get('/trainer/int:id/first_moves', (req, res) async {
var id = req.params['id'] as int;
var executor = req.container.make<QueryExecutor>();
var trainer = await findTrainer(id);
var query = PokemonQuery()..where.trainerId.equals(id);
var pokemon = await query.get(executor);
return =>;
This section of the Angel documentation consists mostly of guides, rather than technical documentation.
For more in-depth documentation, see the actual angel_orm project on Github:
Copy link