NetworkTileProvider class

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.

Inheritance

Constructors

NetworkTileProvider({Map<String, String>? headers, Client? httpClient, bool silenceExceptions = false, bool attemptDecodeOfHttpErrorResponses = true, bool abortObsoleteRequests = true, MapCachingProvider? cachingProvider})
TileProvider to fetch tiles from the network.

Properties

abortObsoleteRequests bool
Whether to abort HTTP requests for tiles that will no longer be displayed.
final
attemptDecodeOfHttpErrorResponses bool
Whether to optimistically attempt to decode HTTP responses that have a non-successful status code as an image
final
cachingProvider MapCachingProvider?
Caching provider used to get cached tiles.
final
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>
Custom HTTP headers that may be sent with each tile request
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
silenceExceptions bool
Whether to ignore exceptions and errors that occur whilst fetching tiles over the network, and just return a transparent tile.
final
supportsCancelLoading bool
Indicates to flutter_map internals whether to call getImage (when false) or getImageWithCancelLoadingSupport
no setteroverride

Methods

dispose() Future<void>
Called when the TileLayer is disposed
override
generateReplacementMap(String urlTemplate, TileCoordinates coordinates, TileLayer options) Map<String, String>
Generate the Map of placeholders to replacements, to be used in populateTemplatePlaceholders
inherited
getImage(TileCoordinates coordinates, TileLayer options) ImageProvider<Object>
Retrieve a tile as an image, based on its coordinates and the TileLayer
inherited
getImageWithCancelLoadingSupport(TileCoordinates coordinates, TileLayer options, Future<void> cancelLoading) ImageProvider<Object>
Retrieve a tile as an image, based on its coordinates and the TileLayer
override
getTileFallbackUrl(TileCoordinates coordinates, TileLayer options) String?
Generate a fallback URL for a tile, based on its coordinates and the TileLayer
inherited
getTileUrl(TileCoordinates coordinates, TileLayer options) String
Generate a primary URL for a tile, based on its coordinates and the TileLayer
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
populateTemplatePlaceholders(String urlTemplate, TileCoordinates coordinates, TileLayer options) String
Replaces placeholders in the form templatePlaceholderElement with their corresponding values
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited