Skip to content
pubscout

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.

$ flutter pub add mbtiles
Source repository

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.

Works with

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