Fix: Add userAgentPackageName to TileLayer for flutter_map v6.2.1 tile rendering

Maps were not rendering in flutter_map v6.2.1 because TileLayer was missing the
required userAgentPackageName property. This property is needed for proper
HTTP requests to tile servers with correct User-Agent headers.

- Updated TileLayer in genericMap.dart with userAgentPackageName
- Updated TileLayer in monitoredAreas.dart with userAgentPackageName
- Fixes: Maps not displaying tiles after flutter_map v6 migration
This commit is contained in:
vjrj 2026-03-05 19:34:02 +01:00
parent fa8c388f07
commit 2486465e44
2 changed files with 4 additions and 1 deletions

View file

@ -214,6 +214,7 @@ class _genericMapState extends State<genericMap> {
maxZoom: maxZoom, maxZoom: maxZoom,
urlTemplate: baseLayer, urlTemplate: baseLayer,
subdomains: subdomains, subdomains: subdomains,
userAgentPackageName: 'com.example.fires_flutter',
additionalOptions: { additionalOptions: {
// 'opacity': '0.1', // 'opacity': '0.1',
}, },

View file

@ -81,7 +81,9 @@ class MonitoredAreasPage extends StatelessWidget {
new TileLayer( new TileLayer(
urlTemplate: urlTemplate:
"https://tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png", "https://tiles.wmflabs.org/bw-mapnik/{z}/{x}/{y}.png",
subdomains: ['a', 'b', 'c']), subdomains: ['a', 'b', 'c'],
userAgentPackageName:
'com.example.fires_flutter'),
new PolylineLayer( new PolylineLayer(
polylines: view.monitoredAreas, polylines: view.monitoredAreas,
) )