allInstancesOfClass<TSubsystem> static method

List<TSubsystem> allInstancesOfClass<TSubsystem>()

All active subsystem instances matching TSubsystem, across every registered SubsystemTypeDesc — not scoped to a single type.

Intended for capability interfaces (e.g. a boot-lifecycle participant mixin) that any subsystem may implement regardless of its type.

Implementation

static List<TSubsystem> allInstancesOfClass<TSubsystem>() {
  final instances = <TSubsystem>[];
  for (final registry in _registriesByTypeDesc.values) {
    for (final singleton in registry.allInstances) {
      if (singleton is TSubsystem) {
        instances.add(singleton as TSubsystem);
      }
    }
  }
  return instances;
}