flutter_map Docs
Project Links💝 Support Us
v5
v5
  • flutter_map
  • How Does It Work?
    • Raster vs Vector Tiles
  • Supporters
  • Getting Started
    • Installation
    • Quickstart
    • Examples
    • Migrating To v5
  • Usage
    • Base Widget
    • Options
    • Layers
    • Controller
    • Event Handling
    • Full API Reference
  • Layers
    • Tile Layer
      • Tile Providers
    • Marker Layer
    • Polygon Layer
    • Polyline Layer
    • Circle Layer
    • Overlay Image Layer
    • Attribution Layer
    • WMS Usage
  • Plugins
    • Plugins List
    • Making A Plugin
      • Creating New Tile Providers
      • Creating New Layers
  • Tile Servers
    • Using Mapbox
    • Using Thunderforest
    • Using Stadia Maps
    • Offline Mapping
    • Other Options
  • Frequently Asked Questions
  • Contributing
  • Credits
Powered by GitBook

© flutter_map Authors & Maintainers

On this page
  • Network Tile Provider
  • Local Tile Providers
  • AssetTileProvider
  • FileTileProvider
  • Offline Mapping

Was this helpful?

Export as PDF
  1. Layers
  2. Tile Layer

Tile Providers

PreviousTile LayerNextMarker Layer

Last updated 1 year ago

Was this helpful?

The tileProvider parameter in TileLayer takes a TileProvider object specifying a to use for that layer.

This has a default of NetworkTileProvider which gets tiles from the internet through a dedicated image provider.

There's two situations in which you'll need to change the tile provider:

  • Sourcing tiles from the filesystem or asset store: Local Tile Providers

  • Using a that instructs you to do so (Creating New Tile Providers)

Network Tile Provider

NetworkTileProvider takes two arguments, but you'll usually never need to specify them:

  • httpClient: custom BaseClient By default, a RetryClient backed by a standard Client is used

  • headers: custom Map<String, String> By default, only the default headers, plus a custom 'User-Agent' header based on the property, are included with each request

Local Tile Providers

These tile providers use the templateUrl to get the appropriate tile from the asset store of the application, or from a file on the users device, respectively.

Specifying any fallbackUrl (even if it is not used) in the TileLayer will reduce the performance of these providers.

It will cause with AssetTileProvider, and will cause main thread blocking when requesting tiles from FileTileProvider.

AssetTileProvider

This tile providers uses the templateUrl to get the appropriate tile from the asset store of the application.

FileTileProvider

This tile providers uses the templateUrl to get the appropriate tile from the a path/directory/file on the user's device - either internal application storage or external storage.

On the web, FileTileProvider() will throw an UnsupportedError when a tile request is attempted, due to the lack of the web platform's access to the local filesystem.

Offline Mapping

If you know you are running on the web platform, use a or a custom tile provider.

Offline Mapping
NetworkTileProvider
plugin
23% slower asset tile requests
userAgentPackageName
tile provider