commit method

  1. @override
void commit()
inherited

Informs the container that the additions are finished and the injector is ready to be used.
This command starts the singletons.

Implementation

@override
void commit() {
  if (committed) throw InjectorAlreadyCommited(_tag);

  committed = true;

  layersGraph.initialize(this);
  layersGraph.executeInAllInjectors(this, (injector) {
    final isCurrentInjector = injector._tag == _tag;
    if (!isCurrentInjector && !injector.committed) {
      injector.commit();
    }
  });
  startSingletons();
}