Tile Layer
TileLayer keeps flutter_map's name and parameters — urlTemplate, subdomains, wmsOptions, tms, zoomOffset,
tileBounds, minNativeZoom / maxNativeZoom, … — but on the native maps the tiles are not drawn by a Dart tile
engine: the platform builds the URL, fetches and renders each tile itself, above its own base map. On web, Windows
and Linux this is flutter_map's own layer, pixel for pixel.
UnifiedMap(
options: MapOptions(initialCenter: brussels, initialZoom: 6),
children: [
TileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
maxNativeZoom: 19,
),
// … markers, polylines, polygons, circles
],
)
Why it differs on iOS and Android
On flutter_map the tile layer is the map. On the native maps the base map — Google Maps on Android, MapKit on iOS
and macOS — is already there, and TileLayer draws on top of it as a native tile overlay:
| Android (Google Maps) | iOS, macOS (MapKit) | Web, Windows, Linux (flutter_map) | |
|---|---|---|---|
| Base map | Google's, under the tiles | Apple's, under the tiles | none — the tiles are the map |
| Hiding the base | MAP_TYPE_NONE while the layer is shown | tile overlay with canReplaceMapContent | n/a |
Fade-in (TileDisplay.fadeIn) | fades new tiles in (its duration is ignored) | shows new tiles at once | full flutter_map behaviour |
| Tile cache | the platform's HTTP cache | the platform's HTTP cache | NetworkTileProvider's cache |
Set nativeParams.replacesBaseMap to hide the base map under the tiles and let them cover the whole view.
Where the tiles come from
- The URL is always built with flutter_map's rules (
urlTemplate,subdomains,tms,zoomReverse,zoomOffset,additionalOptions,tileBounds,retinaMode). With the defaultNetworkTileProviderthe platform fetches the tiles itself, with the provider'sheaders. - Any other
TileProvider— andwmsOptions— goes through a Dart tile bridge: the platform asks the core for each tile, the core loads it withTileProvider.getImageand encodes it as PNG. Correct everywhere, but slower than the native fetch. keepBuffer,panBuffer,tileBuilder,evictErrorTileStrategyandtileUpdateTransformerdrive flutter_map's tile engine only: the native platforms cache, prefetch and retry on their own (tiles are images there, not widgets). Send a value on theresetstream to drop the platform's tile cache and reload the visible tiles.errorImageis drawn natively for failed tiles;errorTileCallbackreceives the failed tile's coordinates.userAgentPackageNamesets theUser-Agentheader toflutter_unified_map (<package>), unless the provider's headers set one (on the web the browser's own is used).
Zoom levels and tile dimensions
minZoom / maxZoom hide the layer outside their range. Above maxNativeZoom the last native level is scaled up,
below minNativeZoom the first one is scaled down — the same on every backend. tileDimension 512 or 1024 follows
the Mapbox convention: each tile covers the extent of a 256 tile one or two levels lower, so use
zoomOffset: -1 / -2 with them.
Raw flutter_map layers
App code can put a raw flutter_map layer inside UnifiedMap with FlutterMapLayer(child: ...):
- on web, Windows and Linux it is drawn inside the map;
- on the native maps (Android, iOS, macOS) it is ignored.
Use it to share code with an existing flutter_map app while the native backends take over.