use<T extends NeuronController> static method
Returns an already installed controller.
Use this method when you know the controller has already been registered via install or ensure.
final controller = Neuron.use<MyController>();
Throws an Exception if the controller is not found in the registry.
Tip: Prefer ensure if you're unsure whether the controller exists, as it will create it if needed.
See also:
- ensure - Get or create a controller
- isInstalled - Check if a controller exists
Implementation
static T use<T extends NeuronController>() {
if (!_registry.containsKey(T)) {
throw Exception(
"Neuron Error: $T not installed. "
"Use Neuron.ensure<$T>(() => ...) before calling use().",
);
}
return _registry[T] as T;
}