operator [] method
MModel?
operator [](
- MSchemaRef ref
Implementation
MModel? operator [](MSchemaRef ref) {
final results = allResults.whereType<MModel>().where((_) => _.mtype == ref);
if (results.isEmpty) {
log.warning(
"No result found with type ${ref.baseCode} ${allResults.isEmpty ? '(the results were empty)' : '- but we found ${allResults.map((_) => _.resultType)}'}");
return null;
} else if (results.length > 1) {
return illegalState(
"Found more than one result for ${ref.baseCode}, but found ${results.length}");
} else {
return results.first;
}
}