handler property

ControllerPlan? get handler

How to call the controller (the last function of controllers), read once. Null when the route has no controller function. Throws a StateError when a parameter type is not known.

Implementation

ControllerPlan? get handler {
  if (!_handlerRead) {
    Object? list = controllers;
    Object? last = list is List<dynamic> && list.isNotEmpty
        ? list.last
        : null;
    _handler = last is Function ? ControllerPlan.of(last, this) : null;
    _handlerRead = true;
  }
  return _handler;
}