mbtiles
0.5.1, released 3 months ago by joscha-eckert.de
Read and write Mapbox MBTiles v1.3 files with support for vector and raster tiles.
What it does
Provides support for working with Mapbox MBTiles v1.3 database files to read metadata and retrieve vector or raster tiles. Allows opening files as read-only or writable, and supports in-memory databases.
AI-written summary of version 0.5.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to read or write Mapbox MBTiles files in your app.
- You want to bundle offline map tiles using raster (jpg, png, webp) or vector (pbf) formats.
Skip it when
- You are targeting Flutter Web, as SQLite is not supported on web.
- You want to load the MBTiles file directly from Flutter assets without copying it to the file system first.
Strengths
- Supports both vector and raster tiles from MBTiles files.
- Allows working with file-based or in-memory databases.
Weaknesses
- Not supported on the web platform due to missing SQLite support.
- Requires manual file copying if the MBTiles file is bundled inside Flutter assets.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 3
For Flutter, store the MBTiles file in path_provider directories, copy it from assets if bundled, and request storage permissions if accessing internal device storage or SD cards.
final mbtiles = MbTiles(path: 'path/to/your/mbtiles-file.mbtiles');
final metadata = mbtiles.getMetadata();
final tile = mbtiles.getTile(z: 0, x: 0, y: 0);
mbtiles.close();Alternatives
Packages that do the same job and could replace mbtiles.
- mapbox_maps_flutter
Official Mapbox Maps SDK for Flutter to render interactive vector maps.
92Compare - maplibre_gl
Native MapLibre maps for Android, iOS and Web with vector tiles, PMTiles, GeoJSON and offline support
91Compare - maplibre
Performant vector maps for Flutter supporting Mapbox Vector Tiles across all six platforms.
90Compare - google_maps_flutter_web
Web platform implementation of google_maps_flutter.
88Compare
Works with
Packages commonly used together with mbtiles: ones it builds on, ones built on it, and its own family.
- sqlite3mbtiles depends on itLightweight and convenient SQLite bindings for Dart using dart:ffi
- latlong2mbtiles depends on itLightweight Dart library for latitude/longitude calculations.
- flutter_map_mbtilesBuilt on mbtilesOffline raster tile provider for flutter_map using MBTiles
- vector_map_tiles_mbtilesBuilt on mbtilesMapbox MBTiles vector tile provider for flutter_map for offline maps