loggingMiddleware function

Handler loggingMiddleware(
  1. Handler handler, {
  2. dynamic onRequest(
    1. Request request
    )?,
  3. dynamic onResponse(
    1. 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;
    };