controller property

T controller

Retrieves the controller instance associa ted with this widget.

Returns the instance of the controller that corresponds to the specified type T. If the controller is not found, an exception is thrown.

Implementation

T get controller {
  try {
    return Dependency.find<T>(tag: tag);
  } catch (e) {
    throw 'Exception : Can\'t find $T\n'
        'Please add the following code inside $runtimeType:\n\n'
        '@override\n'
        'BindController<$T>? bindController() {\n'
        '   return BindController(controller: $T());\n'
        '}\n\n'
        '\nException: class $T is not present in the Dependency store\n';
  }
}