runContained method

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

Run a function after injecting from service container. If this function has been reflected before, then the execution will be faster, as the injection requirements were stored beforehand.

Implementation

Future runContained(Function handler, RequestContext req, ResponseContext res,
    [Container? container]) {
  container ??= Container(EmptyReflector());
  return Future.sync(() {
    if (_preContained.containsKey(handler)) {
      return handleContained(handler, _preContained[handler]!, container)(
          req, res);
    }

    return runReflected(handler, req, res, container);
  });
}