load<T extends KareeModule> static method

FutureOr<void> load<T extends KareeModule>(
  1. T e
)

Function used to subcribe our module in Karee. It does not means that it will be immediatly loaded. It will be loaded at same time with the root application if the KareeModule.startWithRoot is set to true. Otherwise it will be loaded when needed.

Implementation

static FutureOr<void> load<T extends KareeModule>(T e) async {
  if (e is KareeRoutableModule) {
    //////////////////////////////////////////////////////////////////////////
    /// When we ask to load a routable module, we'll init it only if it's the
    /// root module. Otherwise, we'll load it later on navigation fails by filte-
    /// ring by route starts with path.
    //////////////////////////////////////////////////////////////////////////

    KareeModule._modules[e.path] = e;

    if (e.startWithRoot) return await e._init();
  }
}