runBeforeResponse method

Future<void>? runBeforeResponse()

Runs the tasks registered with beforeResponse, each once.

Response.makeResponse calls this before writing; the request handler calls it again when the request ends, for a response written some other way.

Returns null when there is nothing to run, so the common case costs the caller no await.

Implementation

Future<void>? runBeforeResponse() {
  if (_beforeResponse == null) return null;
  return _runAll();
}