I am running Flutter 2.2.2 with Dart 2.13 for a web site on Firebase Hosting. When I do an update to the web site, I need to press reload to see the changes. Is there a setting that I can force the reload only when I update the content?
I can force the cache to reload if I set 'Cache-Control' to 'no-cache' in the HTTP headers. However, that is not an acceptable solution as the site takes too long to load.
this article seems to indicate that the user should not have to press reload even when I don't specify 'no-cache'
The relevant portion is below. Can anyone tell me how I can get the web updates viewable to my audience without people have to press the "reload" button on the browser?
> To start, we’ve optimized caching behavior with a new service worker-loading mechanism, and fixed double-downloading of main.dart.js. In previous versions of Flutter web, the service worker downloaded updates to your app in the background while giving your user access to the stale version of your app. Once that update was downloaded, the user wouldn’t see those changes until they refreshed the browser page a couple times. As of Flutter 2.2, when the new service worker detects a change, the user will wait until the updates are downloaded to use the app, but then they’ll see the updates without requiring a second manual refresh of the page.
Enabling this change requires you to regenerate the index.html of your Flutter app. To do that, save your modifications, delete the index.html file, and then run flutter create . in your project directory to recreate it.