flutter_map_mbtiles 1.0.4  flutter_map_mbtiles: ^1.0.4 copied to clipboard
flutter_map_mbtiles: ^1.0.4 copied to clipboard
Mapbox MBTiles tile provider for flutter_map that can be used for a map that is 100% offline.
flutter_map_mbtiles #
Raster and Vector MBTiles TileProvider
for flutter_map.
- Supported raster tiles: jpg,png,webp
- If you want to use pbfvector tiles you can use vector_map_tiles_mbtiles.
- Web is not supported because of it's lacking SQLite support.
Getting started #
pubspec.yaml
dependencies:
  flutter_map: ^6.0.0         # in case you don't have it yet 
  flutter_map_mbtiles: ^1.0.0 # this package
copied to clipboard
Usage #
// provide the path of the MBTiles file to the tile provider.
// The file must be on your file system and the app must have the permission 
// to access to it. The file can't be in your assets.
final _futureTileProvider = MbTilesTileProvider
    .fromSource('path/to/file.mbtiles');
@override
Widget build(BuildContext context) {
  return FlutterMap(
    options: MapOptions(),
    children: [
      TileLayer(
        // use your awaited MbTilesTileProvider
        tileProvider: tileProvider,
      ),
    ],
  );
}
@override
void dispose() {
// close mbtiles database
  tileProvider.dispose();
  super.dispose();
}
copied to clipboard
Additional information #
If you need help you
can open an issue
or join
the flutter_map discord server.