transformRequest property
A callback that can transform tile requests by modifying URLs and adding headers. This is particularly useful for adding authentication headers to tile requests.
Example:
transformRequest: (url, resourceType) {
if (resourceType == 'Tile') {
return {
'url': url.replaceAll('~~TILE_ENDPOINT~~', 'https://your-tile-server.com'),
'headers': {'Authorization': 'Bearer $apiKey'}
};
}
return {'url': url};
}
Note: This is fully supported on Web. On Android and iOS, only headers are supported.
Implementation
final TransformRequestCallback? transformRequest;