controller property
S
get
controller
Access the controller instance.
The controller is retrieved from the dependency store. If not found, an exception is thrown with instructions on how to bind it.
Example:
@override
Widget build(BuildContext context) {
controller.someMethod();
return Observer(
listenable: controller.someReactive,
listener: (value) => Text('$value'),
);
}
Implementation
S get controller {
try {
return Dependency.find<S>(tag: tag);
} catch (e) {
throw 'Exception : Can\'t find $S\n'
'Please add the following code inside $runtimeType:\n\n'
'@override\n'
'$S bindController() => () => $S();\n'
'\nException: class $S is not present in the Dependency store\n';
}
}