controllerByType<U extends ControllerMVC> method

U? controllerByType<U extends ControllerMVC>()
inherited

Retrieve a Controller in the MVC framework by type.

Implementation

U? controllerByType<U extends ControllerMVC>() {
  // Look in this State objects list of Controllers.  Maybe not?

  U? con = _cons[_type<U>()] as U?;

  if (con == null) {
    final controllers = rootState?._controllers.toList();
    if (controllers != null) {
      for (final cont in controllers) {
        if (cont.runtimeType == _type<U>()) {
          con = cont as U?;
          break;
        }
      }
    }
  }
  return con;
}