Last updated:
0 purchases
flutter map pmtiles
flutter_map_pmtiles #
A TileProvider for flutter_map that adds support for PMTiles.
Getting started #
Add the following packages to your pubspec.yaml file:
dependencies:
flutter_map: ^6.0.0 # in case you don't have it yet
flutter_map_pmtiles: ^1.0.0 # this package
copied to clipboard
Usage #
Initiate the TileProvider
// ...from an URL
final Future<PmTilesTileProvider> _futureTileProvider = PmTilesTileProvider
.fromSource('https://example.com/useYourOwnHostedPMTilesFile.pmtiles');
// ...from an local file on the file system
final Future<PmTilesTileProvider> _futureTileProvider = PmTilesTileProvider
.fromSource('some/file/system/path.pmtiles');
// ...or provide a PmTilesArchive directly
// (you'll need to add pmtiles as direct dependency to your project)
final Future<PmTilesTileProvider> _futureTileProvider = PmTilesTileProvider
.fromArchive(somePmTilesArchive);
copied to clipboard
Await the response of the future, e.g. by using a FutureBuilder.
Provide your PmTilesTileProvider to your TileLayer
@override
Widget build(BuildContext context) {
return FlutterMap(
options: MapOptions(),
children: [
TileLayer(
// use your awaited PmTilesTileProvider
tileProvider: tileProvider,
),
],
);
}
copied to clipboard
Additional information #
If you need help you
can open an issue
or join
the flutter_map discord server.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.