setCustomHeaders method

Future<void> setCustomHeaders(
  1. Map<String, String> headers
)

Sets custom headers for all Mapbox HTTP requests

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

Future<void> setCustomHeaders(Map<String, String> headers) async {
  try {
    await _channel.invokeMethod('map#setCustomHeaders', {'headers': headers});
  } on MissingPluginException catch (e) {
    throw PlatformException(
      code: 'MISSING_IMPLEMENTATION',
      message: 'Native implementation for setCustomHeaders is not available',
      details: e.toString(),
    );
  } catch (e) {
    throw PlatformException(
      code: 'SET_HEADERS_FAILED',
      message: 'Failed to set custom headers',
      details: e.toString(),
    );
  }
}