findSubsystemByIdsChecked<TSubsystem extends Subsystem> static method
Finds a subsystem singleton or throws SubsystemNotFoundException if absent.
Implementation
static TSubsystem findSubsystemByIdsChecked<TSubsystem extends Subsystem>(
String typeId,
String classId,
) {
final registry = findRegistryForTypeId(typeId);
if (registry == null) {
throw SubsystemNotFoundException(
'No registry found for typeId $typeId',
typeId: typeId,
classId: classId,
);
}
final singleton = registry.findByClassId(classId);
if (singleton == null) {
throw SubsystemNotFoundException(
'No singleton found for classId $classId in typeId $typeId',
typeId: typeId,
classId: classId,
);
}
if (singleton is! TSubsystem) {
throw TypeError();
}
return singleton;
}