setSharedHeaders method

void setSharedHeaders(
  1. Map<String, String> headers, {
  2. bool override = false,
})

Call this method to add new headers to the Connection Manager to be used for all the API calls toghether with constantHeaders passed to the constructor.

To add an "Authorization" header, use setAuthHeader.

Implementation

void setSharedHeaders(Map<String, String> headers, {bool override = false}) {
  if (override) {
    _addedHeaders = headers;
  } else {
    headers.removeWhere((key, value) => this.headers.containsKey(key));
    _addedHeaders.addAll(headers);
  }
}