Using Mapbox
Last updated
Was this helpful?
Was this helpful?
FlutterMap(
options: MapOptions(
center: LatLng(51.5, -0.09),
zoom: 13.0,
),
nonRotatedChildren: [
// This does NOT fulfill Mapbox's requirements for attribution
// See https://docs.mapbox.com/help/getting-started/attribution/
AttributionWidget.defaultWidget(
source: '© Mapbox © OpenStreetMap',
onSourceTapped: () async {
// Requires 'url_launcher'
if (!await launchUrl(Uri.parse("https://docs.mapbox.com/help/getting-started/attribution/"))) {
if (kDebugMode) print('Could not launch URL');
}
},
)
],
children: [
TileLayer(
urlTemplate: "https://api.mapbox.com/styles/v1/<user>/<tile-set-id>/tiles/<256/512>/{z}/{x}/{y}@2x?access_token={access_token}",
additionalOptions: {
"access_token": "<ACCESS-TOKEN>",
},
userAgentPackageName: 'com.example.app',
),
],
);