local_mbtiles_server library

Local HTTP tile server for plain and SQLCipher-encrypted MBTiles.

Serve protected offline tiles to any map SDK over loopback HTTP:

import 'package:local_mbtiles_server/local_mbtiles_server.dart';

final source = await MbtilesSource.open(
  path: '/path/to/encrypted.mbtiles',
  id: 'offline',
  password: 'my-passphrase',
);
final server = LocalMbtilesServer();
await server.register(source);
await server.start();
// http://127.0.0.1:8080/offline/{z}/{x}/{y}.pbf

Classes

LocalMbtilesServer
Localhost HTTP tile server backed by registered TileSources.
MbtilesHeaders
Builds HTTP tile responses from TileFormat and tile bytes.
MbtilesMetadata
Parsed contents of the MBTiles metadata table.
MbtilesServerConfig
Configuration for LocalMbtilesServer.
MbtilesServerHealth
Runtime status of a LocalMbtilesServer.
MbtilesSource
Reads tiles from a plain or SQLCipher-encrypted MBTiles SQLite database.
RouteParser
Parses HTTP path segments into validated TileRoute values.
TileCoordinates
Validates and converts web-map XYZ coordinates to MBTiles TMS rows.
TileResponse
Tile bytes and HTTP header fields returned by the server.
TileRoute
Parsed tile request path: /{sourceId}/{z}/{x}/{y}[.ext].
TileSource
Provides tile bytes and metadata from a backing store (e.g. MBTiles).

Enums

TileFormat
Supported MBTiles tile formats and their HTTP response properties.
TileKind
Broad category of tile content stored in MBTiles.

Typedefs

MbtilesServerErrorCallback = void Function(Object error, StackTrace stackTrace)
Called when the tile server encounters an unhandled error.

Exceptions / Errors

DuplicateSourceException
A tile source id is already registered on the server.
InvalidTileRequestException
HTTP tile request used invalid coordinates or path segments.
MbtilesOpenException
Failed to open or read an MBTiles database.
MbtilesServerException
Base exception for local_mbtiles_server failures.
SourceNotFoundException
A requested tile source id is not registered.
UnsupportedTileFormatException
MBTiles metadata.format is missing or not supported by this package.