setMaxRequestsPerHost method
- int max
Sets the maximum number of concurrent HTTP requests per host that the underlying HTTP service may issue.
Lowering this value reduces the chance of hitting per-token rate limits when downloading large amounts of data (for example, offline tile regions), at the cost of slower throughput.
This is a global setting that applies to all Mapbox HTTP requests across the process; calling it on any map instance updates it for all of them.
max must be in the range 1..255.
Throws a PlatformException if the native implementation is not available or if the operation fails.
Implementation
Future<void> setMaxRequestsPerHost(int max) async {
try {
await _channel.invokeMethod('map#setMaxRequestsPerHost', {'max': max});
} on MissingPluginException catch (e) {
throw PlatformException(
code: 'MISSING_IMPLEMENTATION',
message:
'Native implementation for setMaxRequestsPerHost is not available',
details: e.toString(),
);
} catch (e) {
throw PlatformException(
code: 'SET_MAX_REQUESTS_PER_HOST_FAILED',
message: 'Failed to set max requests per host',
details: e.toString(),
);
}
}