startServices method

Future<void> startServices()

Starts all services described by serviceDescriptors, solving dependencies by recursively starting only satisfied services until all descriptors have either declined registration or have been started.

If a dependency resolution cycle elapses without any emitted services, the service graph is considered broken and an UnsatisfiedServiceDependenciesException will be thrown.

Implementation

Future<void> startServices() async {
  var logging = (this as DarwinSystemLoggingMixin);
  lifecycleState = SystemLifecycleState.starting;
  var resolver = ServiceMixinResolver(this);
  await resolver.solve(serviceDescriptors).forEach((element) {
    if (logging.level.value <= element.type.level.value) {
      logging.handler(element.type.createLog(element));
    }
    if (element.type == ResolveEventType.failed) throw Exception();
  });
  lifecycleState = SystemLifecycleState.started;
}