setCustomHeaders method

  1. @Deprecated('Headers set this way are attached to every host the map fetches from, ' 'including third-party hosts, which can leak credentials. Use ' 'httpService.setCustomHeadersForHost to scope headers to a specific host.')
Future<void> setCustomHeaders(
  1. Map<String, String> headers
)

Sets custom HTTP headers that are attached to every request the map makes, regardless of host.

Warning: these headers are attached to every outgoing request, including requests to third-party hosts referenced by the loaded style, sources, sprites, glyphs and tiles. Placing a credential here can leak it to hosts you do not control.

Use httpService.setCustomHeadersForHost to attach headers to a specific host only.

headers is a map of header names to header values.

Throws a PlatformException if the native implementation is not available or if the operation fails.

Implementation

@Deprecated(
    'Headers set this way are attached to every host the map fetches from, '
    'including third-party hosts, which can leak credentials. Use '
    'httpService.setCustomHeadersForHost to scope headers to a specific host.')
Future<void> setCustomHeaders(Map<String, String> headers) =>
    // ignore: deprecated_member_use_from_same_package
    httpService.setCustomHeaders(headers);