flutter_map_tile_caching_plus
An enhanced plugin for 'flutter_map' providing advanced offline tile caching, bulk downloading, and cache management.
Features
- Offline tile caching — automatically cache map tiles for offline use
- Bulk downloading — download entire map regions (rectangle, circle, line, polygon) with progress tracking
- Multi-threaded downloads — configurable parallel download threads for maximum speed
- Smart HTTP retry — automatic retry for transient HTTP errors (429/503)
- Configurable retry strategy — control how many retry passes are performed for failed tiles
- Memory-bounded buffers — limit buffer memory usage during bulk downloads
- Cache management — create, rename, delete, and query tile stores
- Recovery system — resume interrupted downloads automatically
- Rate limiting — configurable tiles-per-second limit to respect server policies
- Sea tile detection — skip caching tiles that are entirely sea
- Multi-store — manage multiple independent tile caches
- Cross-platform — Android, iOS, Linux, macOS, Windows
Installation
Add to your pubspec.yaml:
dependencies:
flutter_map_tile_caching_plus: ^11.0.0
Then run:
flutter pub get
Quick Start
1. Initialize the backend
import 'package:flutter_map_tile_caching_plus/flutter_map_tile_caching_plus.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await FMTCObjectBoxBackend().initialise();
runApp(MyApp());
}
2. Create a tile store
await const FMTCStore('myMapStore').manage.create();
3. Use the tile provider with flutter_map
FlutterMap(
options: MapOptions(
initialCenter: LatLng(51.5, -0.09),
initialZoom: 13,
),
children: [
TileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
tileProvider: const FMTCStore('myMapStore').getTileProvider(),
),
],
)
4. Bulk download a region for offline use
final region = RectangleRegion(
LatLngBounds(LatLng(51.45, -0.15), LatLng(51.55, -0.05)),
).toDownloadable(
minZoom: 10,
maxZoom: 16,
options: TileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
),
);
final (:tileEvents, :downloadProgress) =
const FMTCStore('myMapStore').download.startForeground(region: region);
downloadProgress.listen((progress) {
print('${progress.percentageProgress.toStringAsFixed(1)}%');
});
API Overview
| Class | Purpose |
|---|---|
FMTCObjectBoxBackend |
Initialize the storage backend |
FMTCStore |
Access a named tile store |
StoreManage |
Create, rename, delete stores |
StoreDownload |
Bulk download regions |
StoreStatistics |
Query store size, tile count, etc. |
FMTCRoot |
Global stats and recovery |
DownloadProgress |
Real-time download statistics |
TileEvent |
Per-tile download result |
For the full API reference, see the dartdoc documentation.
Migrating from flutter_map_tile_caching
This package is a maintained fork of flutter_map_tile_caching by JaffaKetchup.
Step 1: Update your dependency
# Before
dependencies:
flutter_map_tile_caching: ^10.1.1
# After
dependencies:
flutter_map_tile_caching_plus: ^11.0.0
Step 2: Update your imports
// Before
import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart';
// After
import 'package:flutter_map_tile_caching_plus/flutter_map_tile_caching_plus.dart';
Step 3: Regenerate ObjectBox code
dart run build_runner build --delete-conflicting-outputs
No other code changes are required — the public API is fully compatible.
About
This project is a fork of flutter_map_tile_caching by JaffaKetchup, maintained by UBXTY Unboxing Technology with a focus on keeping up with the latest Flutter, Dart, and flutter_map versions.
Maintainer
Ravdeep Singh — UBXTY Unboxing Technology
License
This project is released under GPL v3. See LICENSE for details.
Permissions of this strong copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights.
For licensing inquiries, please open an issue.
Libraries
- custom_backend_api
- Specialised sub-library of FMTC which provides access to some semi-public internals necessary to create custom backends or work more directly with them
- flutter_map_tile_caching_plus
- A plugin for 'flutter_map' providing advanced offline functionality