addControllers method

dynamic addControllers(
  1. Map<Type, dynamic> controllers
)

Add Controllers to your Nylo project.

Implementation

addControllers(Map<Type, dynamic> controllers) {
  for (var controllerDecoder in controllers.entries) {
    if (controllerDecoder.value is NyController Function()) {
      _controllerDecoders
          .addAll({controllerDecoder.key: controllerDecoder.value});
    }

    if (controllerDecoder.value is NyController) {
      _singletonControllers
          .addAll({controllerDecoder.key: controllerDecoder.value});
    }
  }

  if (!Backpack.instance.isNyloInitialized()) {
    Backpack.instance.save("nylo", this);
  }
}