Skip to content

[BUG] Tiles not updated when urlTemplate changes if tile provider not reconstructed #183

@codeOfJannik

Description

@codeOfJannik

What is the bug?

When a FMTCTileProvider is used and the urlTemplate is switched during runtime, the rendered map tiles on the currently visible map area are not updated to the style of the new url template. Also emitting an event to the reset stream of the TileLayer does not force the layer to show the new style. But if you move around the map, new map tiles are rendered in the new style. So switching the url template in general works.

How can we reproduce it?

  • Take the flutter_map 8.1.0 example app
  • add flutter_map_tile_caching as a dependency
  • add FMTC init and setup to main.dart:
WidgetsFlutterBinding.ensureInitialized();
await FMTCObjectBoxBackend().initialise();
await const FMTCStore('mapStore').manage.create();
  • to lib/pages/reset_tile_layer.dart add the FMTCTileProvider logic:
final _fmtcTileProvider = FMTCTileProvider(stores: {'mapStore': BrowseStoreStrategy.readUpdateCreate}, httpClient: httpClient);

final httpClient = IOClient(HttpClient()..userAgent = null);

class ResetTileLayerPage extends StatefulWidget {
TileLayer(
    reset: resetController.stream,
    urlTemplate: layerToggle ? layer1 : layer2,
    subdomains: layerToggle ? const [] : const ['a', 'b', 'c'],
    userAgentPackageName: 'dev.fleaflet.flutter_map.example',
    tileProvider: _fmtcTileProvider,
),

Do you have a potential solution?

No response

Platforms

tested on iOS device and Android emulator

Severity

Obtrusive: Prevents normal functioning but causes no errors in the console

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue reports broken functionality or another error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions