NetworkTileProvider constructor

NetworkTileProvider({
  1. Map<String, String>? headers,
  2. Client? httpClient,
  3. bool silenceExceptions = false,
  4. bool attemptDecodeOfHttpErrorResponses = true,
  5. bool abortObsoleteRequests = true,
  6. MapCachingProvider? cachingProvider,
})

TileProvider to fetch tiles from the network.

By default, a RetryClient is used to retry failed requests. 'dart:http' or 'dart:io' might be needed to override this.

On the web, the 'User-Agent' header cannot be changed, as specified in TileLayer.tileProvider's documentation, due to a Dart/browser limitation.

Does not support cancellation of tile loading via TileProvider.getImageWithCancelLoadingSupport, as abortion of in-flight HTTP requests on the web is not yet supported in Dart.

Implementation

NetworkTileProvider({
  super.headers,
  Client? httpClient,
  this.silenceExceptions = false,
  this.attemptDecodeOfHttpErrorResponses = true,
  this.abortObsoleteRequests = true,
  this.cachingProvider,
})  : _isInternallyCreatedClient = httpClient == null,
      _httpClient = httpClient ?? RetryClient(Client());