load method
Loads relations (list or map with constraints) onto this model.
Implementation
Future<Model> load(Object relations) async {
final batch = _batches[this];
final names = batch == null ? null : _plainNames(relations);
if (names != null) {
for (final name in names) {
await batch!.load(this, name);
}
return this;
}
if (batch != null) {
// This load replaces what a sibling's brought in.
for (final key in ModelQuery.parseWith(relations).keys) {
batch.takePreloaded(this, key.split('.').first);
}
}
await modelDefinition.eagerLoad([this], relations, db: _db);
return this;
}