customHeadersInterceptor static method

Interceptor customHeadersInterceptor(
  1. Map<String, String> headers
)

Creates a custom header interceptor that adds headers to all requests

Implementation

static Interceptor customHeadersInterceptor(Map<String, String> headers) {
  return InterceptorsWrapper(
    onRequest: (options, handler) {
      options.headers.addAll(headers);
      handler.next(options);
    },
  );
}