HttpMiddleware typedef
HttpMiddleware =
Future<StreamedResponse> Function(BaseRequest request, Future<StreamedResponse> next(BaseRequest))
Function signature for HTTP middleware.
Middleware functions can modify requests before they are sent and responses before they are processed. They follow a chain-of-responsibility pattern where each middleware calls the next one in the chain.
request The HTTP request being processed.
next Function to call the next middleware or send the request.
Returns a Future that resolves to the HTTP response.
Implementation
typedef HttpMiddleware =
Future<http.StreamedResponse> Function(
http.BaseRequest request,
Future<http.StreamedResponse> Function(http.BaseRequest) next,
);