registerSubsystems method

Future<List<TSubsystem>> registerSubsystems({
  1. bool flushAfter = true,
  2. bool atomicBatch = false,
})

Builds and initializes all registered subsystems.

Clears the factory by default (flushAfter = true).

If atomicBatch is true, a failure in any subsystem rolls back all previously built instances from this batch. When false (the default), only the failing instance is rolled back and successfully initialized subsystems remain active.

Implementation

Future<List<TSubsystem>> registerSubsystems({
  bool flushAfter = true,
  bool atomicBatch = false,
}) async {
  final out = await SubsystemInstanceRegistry.buildInstances<TSubsystem>(
    _registrations.toList(growable: false),
    atomicBatch: atomicBatch,
  );

  if (flushAfter) {
    _registrations.clear();
  }

  return out;
}