runReflected method

Future runReflected(
  1. Function handler,
  2. RequestContext req,
  3. ResponseContext res, [
  4. Container? container,
])

Runs with DI, and always reflects. Prefer runContained.

Implementation

Future runReflected(Function handler, RequestContext req, ResponseContext res,
    [Container? container]) {
  container ??=
      req.container ?? res.app?.container ?? Container(EmptyReflector());

  if (container.reflector is EmptyReflector) {
    throw ArgumentError("No `reflector` passed");
  }
  var h = handleContained(
      handler,
      _preContained[handler] = preInject(handler, container.reflector),
      container);
  return Future.sync(() => h(req, res));
  // return   closureMirror.apply(args).reflectee;
}