TileLayer class

Describes the needed properties to create a tile-based layer. A tile is an image bound to a specific geographical position.

You should read up about the options by exploring each one, or visiting https://docs.fleaflet.dev/usage/layers/tile-layer. Some are important to avoid issues.

Inheritance
Annotations

Constructors

TileLayer({Key? key, String? urlTemplate, String? fallbackUrl, double tileSize = 256, double minZoom = 0, double maxZoom = double.infinity, int minNativeZoom = 0, int maxNativeZoom = 19, bool zoomReverse = false, double zoomOffset = 0.0, Map<String, String> additionalOptions = const {}, List<String> subdomains = const ['a', 'b', 'c'], int keepBuffer = 2, int panBuffer = 1, @Deprecated('Prefer `MapOptions.backgroundColor`. ' 'This property has been removed simplify interaction when using multiple `TileLayer`s. ' 'This property is deprecated since v6.') Color? backgroundColor, ImageProvider<Object>? errorImage, TileProvider? tileProvider, bool tms = false, WMSTileLayerOptions? wmsOptions, TileDisplay tileDisplay = const TileDisplay.fadeIn(), bool? retinaMode, ErrorTileCallBack? errorTileCallback, @Deprecated('Prefer creating a custom `TileProvider` instead. ' 'This option has been deprecated as it is out of scope for the `TileLayer`. ' 'This option is deprecated since v6.') TemplateFunction? templateFunction, TileBuilder? tileBuilder, EvictErrorTileStrategy evictErrorTileStrategy = EvictErrorTileStrategy.none, Stream<void>? reset, LatLngBounds? tileBounds, TileUpdateTransformer? tileUpdateTransformer, String userAgentPackageName = 'unknown'})

Properties

additionalOptions Map<String, String>
Static information that should replace placeholders in the urlTemplate. Applying API keys is a good example on how to use this parameter.
final
backgroundColor Color?
Color shown behind the tiles
final
errorImage ImageProvider<Object>?
Tile image to show in place of the tile that failed to load.
final
errorTileCallback ErrorTileCallBack?
This callback will be executed if an error occurs when fetching tiles.
final
evictErrorTileStrategy EvictErrorTileStrategy
final
fallbackUrl String?
Fallback URL template, used if an error occurs when fetching tiles from the urlTemplate.
final
hashCode int
The hash code for this object.
no setterinherited
keepBuffer int
When panning the map, keep this many rows and columns of tiles before unloading them.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxNativeZoom int
Maximum zoom number supported by the tile source has available.
latefinal
maxZoom double
The maximum zoom level up to which this layer will be displayed (inclusive).
latefinal
minNativeZoom int
Minimum zoom level supported by the tile source
latefinal
minZoom double
The minimum zoom level down to which this layer will be displayed (inclusive)
latefinal
panBuffer int
When loading tiles only visible tiles are loaded by default. This option increases the loaded tiles by the given number on both axis which can help prevent the user from seeing loading tiles whilst panning. Setting the pan buffer too high can impact performance, typically this is set to zero or one.
final
reset Stream<void>?
Stream to notify the TileLayer that it needs resetting
final
resolvedRetinaMode RetinaMode
Resolved retina mode, based on the retinaMode passed in the constructor and the urlTemplate
latefinal
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subdomains List<String>
List of subdomains for the URL.
final
templateFunction TemplateFunction?
final
tileBounds LatLngBounds?
Only load tiles that are within these bounds
final
tileBuilder TileBuilder?
Function which may Wrap Tile with custom Widget There are predefined examples in 'tile_builder.dart'
final
tileDisplay TileDisplay
final
tileProvider TileProvider
Provider with which to load map tiles
latefinal
tileSize double
Size for the tile. Default is 256
latefinal
tileUpdateTransformer TileUpdateTransformer
This transformer modifies how/when tile updates and pruning are triggered based on MapEvents. It is a StreamTransformer and therefore it is possible to filter/modify/throttle the TileUpdateEvents. Defaults to TileUpdateTransformers.ignoreTapEvents which disables loading/pruning for map taps, secondary taps and long presses. See TileUpdateTransformers for more transformer presets or implement your own.
final
tms bool
If true, inverses Y axis numbering for tiles (turn this on for TMS services).
final
urlTemplate String?
The URL template is a string that contains placeholders, which, when filled in, create a URL/URI to a specific tile.
final
wmsOptions WMSTileLayerOptions?
If not null, then tiles will pull's WMS protocol requests
final
zoomOffset double
The zoom number used in tile URLs will be offset with this value.
latefinal
zoomReverse bool
If set to true, the zoom number used in tile URLs will be reversed (maxZoom - zoom instead of zoom)
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<StatefulWidget>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

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