Skip to content

[BUG] Style appears to load from local cache and not URL #261

@jt274

Description

@jt274

Platforms

All

Version of flutter-maplibre

0.2.1

Bug Description

I am loading a style file in initStyle from a remote URL on my server. I'd made a change to the style and updated the file on the server. However, it appears that the old version is still being loaded by the app. I understand some web servers may cache requests, but I can confirm I have disabled cache. In fact, it does not appear that the plugin is even making a request to the server.

To test this, I can confirm both on my server and using Flutter DevTools that the file is not even being requested via the URL. If I slightly change the URL, such as adding a character somewhere, I see the request come through and an error response due to the incorrect URL.

Is there some kind of caching happening in the plugin to store the style file locally, and if so, is there a way to disable it?

Steps to Reproduce

  1. Load map with initStyle as remote URL.
  2. Change remote file.
  3. Load map again with same URL and see that the style is not updated.

Expected Results

The plugin should request the file from the URL, or provide some way to set a cache timeout. The server should determine if the cached file is still valid using the Cache-Control header.

Actual Results

Style is only loaded once, and not loaded again unless the file name changes (or possibly after an unknown period of time).

Code Sample

MapLibreMap(
            options: MapOptions(
              initStyle:
                  'https://mysite.com/styles/light.json?key=$key',
            ),
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions