configure static method

void configure({
  1. String? base,
  2. Map<String, String>? headers,
  3. Interceptor? interceptor,
  4. AfterEffect? afterEffect,
  5. bool? applyGlobalInterceptor,
  6. bool? applyGlobalAfterEffect,
})

Configures the HTTP client globally.

  • base: sets the base URL.
  • headers: sets default headers.
  • interceptor: sets a global request interceptor.
  • afterEffect: sets a global after-response hook.
  • applyGlobalInterceptor: whether to run global interceptor by default.
  • applyGlobalAfterEffect: whether to run global afterEffect by default.

Implementation

static void configure({
  String? base,
  Map<String, String>? headers,
  Interceptor? interceptor,
  AfterEffect? afterEffect,
  bool? applyGlobalInterceptor,
  bool? applyGlobalAfterEffect,
}) {
  if (base != null) baseUrl = base;
  if (headers != null) defaultHeaders = headers;
  if (interceptor != null) globalInterceptor = interceptor;
  if (afterEffect != null) globalAfterEffect = afterEffect;
  if (applyGlobalInterceptor != null)
    useGlobalInterceptor = applyGlobalInterceptor;
  if (applyGlobalAfterEffect != null)
    useGlobalAfterEffect = applyGlobalAfterEffect;
}