intercept<T> static method

Future<T> intercept<T>(
  1. Future<T> requestFn(), {
  2. required String method,
  3. required String url,
  4. dynamic body,
  5. Map<String, String>? headers,
})

Intercept any HTTP request

requestFn - The function that makes the HTTP request method - HTTP method (GET, POST, PUT, DELETE, etc.) url - The URL being requested body - Optional request body headers - Optional request headers

Implementation

static Future<T> intercept<T>(
  Future<T> Function() requestFn, {
  required String method,
  required String url,
  dynamic body,
  Map<String, String>? headers,
}) async {
  return _interceptRequest(method, url, body, headers, requestFn);
}