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 A Plugin
      • Creating New Tile Providers
      • Creating New Layers
  • Thanks
    • 💝Supporters
    • ✏️Credits & Contributing
Powered by GitBook

© flutter_map Authors & Maintainers

On this page
  • Disabling built-in caching
  • Configuration
  • Managing the cache

Was this helpful?

Edit on GitHub
Export as PDF
  1. Layers
  2. Tile Layer

Built-In Caching

PreviousTile ProvidersNextMarker Layer

Last updated 8 days ago

Was this helpful?

This page contains references to as-of-yet unconfirmed features, which may change without warning. The information on this page is likely to change frequently, and potentially significantly, or may be removed completely.

See for progress.

From v8.2.0, flutter_map provides simple automatically-enabled built-in caching for the NetworkTileProvider (and CancellableNetworkTileProvider in the near-future) on native platforms.

Built-in caching is not a replacement for caching which can better guarantee resilience. It provides no guarantees as to the safety of cached tiles, which may become unexpectedly lost/inaccessible at any time.

It should not be relied upon where not having cached tiles may lead to a dangerous situation - for example, offline mapping. See Offline Mapping for information about implementing more appropriate solutions.

Built-in caching aims to:

  • Reduce the strain on tile servers (particularly the )

  • Improve compliance with tile server terms/requirements

  • Reduce the costs of using tile servers by reducing unnecessary tile requests

  • Potentially improve map tile loading speeds

It does, however, come at the expense of usage of on-device storage capacity.

It uses HTTP caching headers returned with tiles to perform this.

Disabling built-in caching

Before disabling built-in caching, you should check that you can still be compliant with any requirements imposed by your tile server.

It is your own responsibility to comply with any appropriate restrictions and requirements set by your chosen tile server/provider. Always read their Terms of Service. Failure to do so may lead to any punishment, at the tile server's discretion.

The built-in caching is designed to be compliant with the caching requirement for the . Disabling it may make your project non-compliant.

If you prefer to disable built-in caching, set the cachingOptions parameter on the tile provider to null.

TileLayer(
    urlTemplate: '',
    userAgentPackageName: '',
    tileProvider: NetworkTileProvider(
        cachingOptions: null,
    ),
),

If you're using a different tile provider that does not use MapTileCachingManager internally, it does not support built-in caching.

Configuration

The cachingOptions parameter can be passed a MapCachingOptions to configure the built-in caching.

insert link

By default, caching occurs in a platform provided cache directory. The operating system may clear this at any time.

By default, a 1GB preferred (soft) limit is applied to the built-in caching.

Managing the cache

check!

It is not directly possible to reset/empty/delete the cache.

On many systems, users can delete the entire app cache through the app's settings. Alternatively, it can be cleared out manually on desktop platforms.

You may also try to delete the cache directory yourself. This is only possible before the cache has been used for the first time in that execution - for example, before the first map tile is loaded.

https://github.com/fleaflet/flutter_map/pull/2082
OpenStreetMap public tile servers
OpenStreetMap public tile server