loggingMiddleware function
Handler
loggingMiddleware(
- Handler handler, {
- dynamic onRequest(
- Request request
- dynamic onResponse(
- Response response
Implementation
Handler loggingMiddleware(Handler handler,
{Function(Request request)? onRequest,
Function(Response response)? onResponse}) =>
(Request request) async {
onRequest?.call(request);
final response = await handler(request);
onResponse?.call(response);
return response;
};