flutter_map Docs
Project Links💝 Support Us
v8
v8
  • flutter_map
  • Why & How
    • 🌟Showcase & Case Studies
    • ❔How Does It Work?
      • Raster vs Vector Tiles
    • 👀Demo & Examples
  • Getting Started
    • 🚀What's New In v8?
    • Installation
  • Usage
    • Base Widget
      • Unbounded Horizontal Scrolling
    • Options
      • Interaction Options
      • Custom CRSs
    • Layers
    • Programmatic Interaction
      • Controllers & Cameras
      • External Custom Controllers
      • Listen To Events
    • Full API Reference
  • Layers
    • Tile Layer
      • Tile Providers
      • Built-In Caching
    • Marker Layer
    • Polygon Layer
    • Polyline Layer
    • Circle Layer
    • Overlay Image Layer
    • Attribution Layer
    • Layer Interactivity
      • Hit Testing Behaviour
  • Tile Servers
    • Using OpenStreetMap (direct)
    • Using Mapbox
    • Using Google Maps
    • Using Tracestrack
    • Using Thunderforest
    • Using Stadia Maps
    • Using Lima Labs
    • Using Bing Maps
    • Offline Mapping
    • Other Options
  • Plugins
    • Plugins List
    • Creating Plugins
      • Tile Providers
      • Layers
      • Caching Providers
  • Thanks
    • 💝Supporters
    • ✏️Credits & Contributing
Powered by GitBook

© flutter_map Authors & Maintainers

On this page
  • Caching
  • Bulk Downloading
  • Bundled Map Tiles
  • Contained
  • Uncontained

Was this helpful?

Edit on GitHub
Export as PDF
  1. Tile Servers

Offline Mapping

PreviousUsing Bing MapsNextOther Options

Last updated 11 days ago

Was this helpful?

Using maps without an Internet connection is common requirement. Luckily, there are a few options available to you to implement offline mapping in your app.

  • Automatically store tiles as the user loads them through interacting with the map, usually on a temporary basis

  • Download an entire area/region of tiles in one shot, ready for a known no-Internet situation

  • Provide a set of pre-determined tiles to all users through app assets or the filesystem

Caching

This section contains references to as-of-yet unreleased versions and unconfirmed features.

Prior to v8.2.0, flutter_map only provided caching in-memory. All cached tiles will be cleared after the app session is ended.

Since v8.2.0, this is no longer the case.

Caching is used usually to improve user experience by reducing network waiting times, not necessarily to prepare for no-Internet situations. Caching can be more temporary (eg. in-memory/session-only, where the cache is cleared after the app is closed), or more long-term (eg. app cache, where the OS takes responsibility for clearing the app cache when necessary/when requested).

Many tile servers, such as the OpenStreetMap tile server, will require you to implement longer-term caching!

Since v8.2.0, flutter_map provides Built-In Caching. This satisfies many requirements of both users and tile servers automatically.

If you'd prefer not to use built-in caching, you can:

  • Try another MapCachingProvider implementation if you still only need simple caching These are compatible with the standard NetworkTileProvider (and cancellable version), as with built-in caching, but use a different storage mechanism. You can create an implementation yourself, or use one provided by a 3rd-party/plugin. See for more info.

  • Use a caching HTTP client NetworkTileProvider.httpClient can be used to set a custom HTTP client. Some packages, such as '', offer clients which perform HTTP caching, similar to built-in caching.

  • Use a different TileProvider Tile providers have full control over how a tile is generated to be displayed, and so there are many possibilities to integrate caching.

    • Create a with a caching ImageProvider (either custom or using a package such as '')

    • Use Caching created prior to built-in caching, lightweight and MIT licensed, but with more pre-provided options than built-in caching through 3rd-party storage implementations

    • Use Supports very advanced caching use-cases and Bulk Downloading, but GPL licensed

Bulk Downloading

You must comply with the appropriate restrictions and terms of service set by your tile server. Always read the ToS before using a tile server. Failure to do so may lead to any punishment, at the tile server's discretion. Many tile servers will forbid or restrict bulk downloading, as it places additional strain on their servers.

Bulk downloading is used to prepare for known no-Internet situations by downloading map tiles, then serving these from local storage.

Bulk downloading is more complex than Caching, especially for regions that are a non-rectangular shape. Implementing this can be very time consuming and prone to issues.

Bundled Map Tiles

If you have a set of custom raster tiles that you need to provide to all your users, you may want to consider bundling them together, to make a them easier to deploy to your users. Bundles can be provided in two formats.

Contained

Container formats, such as the traditional MBTiles, or the more recent PMTiles, store tiles usually in a database or binary internal format.

These require a special parser to read on demand, usually provided as a TileProvider by a plugin. The following community-maintained plugins are available to read these formats:

Uncontained

When uncontained, tiles are usually in a tree structure formed by directories, usually 'zoom/x/y.png'. These don't require special parsing, and can be provided directly to the TileLayer using one of the built-in local TileProviders.

AssetTileProvider

You can ship an entire tile tree as part of your application bundle, and register it as assets in your app's pubspec.yaml.

This means that they will be downloaded together with your application, keeping setup simple, but at the expense of a larger application bundle size.

If using AssetTileProvider, every sub-directory of the tree must be listed seperately. See the example application's 'pubspec.yaml' for an example.

FileTileProvider

This allows for more flexibility: you could store a tile tree on a remote server, then download the entire tree later to the device's filesystem, perhaps after intial setup, or just an area that the user has selected.

This means that the setup may be more complicated for users, and it introduces a potentially long-running blocking action, but the application's bundle size will be much smaller.

The includes advanced bulk downloading functionality, of multiple different region shapes, and other functionality. It is however GPL licensed. To help choose whether FMTC or DIY is more appropriate for your use case, please see:

: (when using vector tiles)

: ( when using vector tiles, also works in online contexts)

community maintained plugin 'flutter_map_tile_caching'
MBTiles
flutter_map_mbtiles
vector_map_tiles_mbtiles
PMTiles
flutter_map_pmtiles
vector_map_tiles_pmtiles
package:http_cache_client
custom TileProvider
package:cached_network_image
flutter_map_cache
flutter_map_tile_caching
Caching
Bulk downloading
Bundling
Is FMTC Right For Me?FMTC Docs
Using Other MapCachingProviders
Logo