initSystem static method

Future initSystem(
  1. DarwinSystem system,
  2. DarwinSystemUserArgs user
)

Implementation

static Future initSystem(
    DarwinSystem system, DarwinSystemUserArgs user) async {
  system.eventbus = EventBus();
  system.injector = Injector();
  system.darwinSystemModule = Module();
  system.injector.registerModule(user.appModule);
  system.injector.registerModule(system.darwinSystemModule);
  system.darwinSystemModule.bind(DarwinSystem).toConstant(system);
  system.darwinSystemModule.bind(Logger).toContextFunction((injector) {
    return system.createLogger("Application");
  });
  var baseConfiguration = await DarwinBaseConfiguration.load(system);
  system.profile = baseConfiguration.profile;
  system.level = baseConfiguration.level;
  system.checkDebug(); // Check and potentially enable debug mode
}