install<T extends NeuronController> static method
- T controller
Registers a controller and calls its NeuronController.onInit hook.
This method manually registers a controller instance. The controller's NeuronController.onInit method is called immediately after registration.
final controller = MyController();
Neuron.install(controller);
Note: In most cases, use ensure instead, which handles both creation and registration in one call.
Returns the registered controller instance.
See also:
Implementation
static T install<T extends NeuronController>(T controller) {
_registry[T] = controller;
if (NeuronDebugRegistry.instance.isEnabled) {
NeuronDebugRegistry.instance.registerController(controller);
}
controller.onInit();
return controller;
}