Skip to content

Latest commit

 

History

History

example

README.md

local_mbtiles_server example

Flutter demo that opens a SQLCipher-encrypted raster MBTiles sample, serves tiles over localhost HTTP, and previews them as a MapLibre overlay.

Sample asset

File assets/fixtures/demo_raster.mbtiles (~56 KB)
Format PNG overlay
Zooms 12–15
Bounds San Francisco demo bbox (-122.45,37.75 → -122.40,37.80)
Password demo-password (passphrase → MbtilesSource.open)
Source id demo

Synthetic colored tiles (not real map imagery). Outside the bbox or below zoom 12 you only see the MapLibre base style.

Regenerate:

bash example/tool/generate_demo_raster_mbtiles.sh

Requires the sqlcipher CLI (brew install sqlcipher on macOS).

Run

cd example
flutter run
  1. Tap Fetch status & metadata (copies the asset, opens it with the passphrase, starts LocalMbtilesServer).
  2. Tap Show tile on map — zoom in on SF to see the overlay; zoom out or pan away to see the base map alone.

Android

Cleartext localhost tile URLs need:

android:usesCleartextTraffic="true"

(already set in this example’s AndroidManifest.xml).

Password helpers

  • Demo pack uses a passphrase (demoSqlCipherPassword).
  • sqlCipherPasswordFromRawKeyBase64 in lib/sqlcipher_password.dart shows how to turn a base64 raw key into the "x'…hex…'" form for other files.