Skip to content
pubscout

flutter_map_cache

2.1.2, released 11 days ago by joscha-eckert.de

A slim caching plugin for flutter_map tile layers supporting multiple storage backends.

WASM-readyRock solid
$ flutter pub add flutter_map_cache
Source repository

What it does

It intercepts tile requests in flutter_map using Dio and caches map tiles to reduce network usage, lower server load, and improve map loading performance. It supports backends like File System, Drift, Hive CE, ObjectBox, Isar, and Sembast.

AI-written summary of version 2.1.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You are using flutter_map and need to cache map tiles to comply with tile usage policies.
  • You want to reduce mobile data usage and load previously visited map regions instantly offline.
  • You need advanced caching backends like Drift, Hive, or Isar instead of the default flutter_map caching.

Skip it when

  • You want a fully automated offline map downloader since this package only caches tiles as they are visited.
  • You are using only sqflite and prefer not to use Drift or other supported storage stores.

Strengths

  • Supports multiple storage backends including File System, Drift, and Hive CE.
  • Includes tile request cancellation out of the box.
  • Reduces mobile data consumption and speeds up repeat visits to map regions.

Weaknesses

  • Does not provide automated bulk tile downloading for complete offline maps.
  • Requires choosing and configuring an additional storage backend package.

Setup

Kind
Flutter widgets
Effort
Medium
Code generation
No
Direct dependencies
3

Requires adding flutter_map_cache along with a chosen storage store package (such as http_cache_file_store or http_cache_hive_store) and setting up paths via path_provider.

FlutterMap(
  options: MapOptions(),
  children: [
    TileLayer(
      urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
      tileProvider: CachedTileProvider(
        maxStale: const Duration(days: 30),
        store: HiveCacheStore(path, hiveBoxName: 'HiveCacheStore'),
      ),
    ),
  ],
)

Alternatives

Packages that do the same job and could replace flutter_map_cache.

Works with

Packages commonly used together with flutter_map_cache: ones it builds on, ones built on it, and its own family.