getRelationOrLoad<R> method
Get relation or load it if not loaded
Implementation
Future<R> getRelationOrLoad<R>(String name) async {
if (hasRelation(name)) {
final relation = getRelation<R>(name);
if (relation != null) return relation;
}
await load(name);
final relation = getRelation<R>(name);
if (relation == null) {
throw Exception('Failed to load relation $name');
}
return relation;
}