Use case
This underlying problem for my suggestion is in theese links:
#104509
fluttercommunity/plus_plugins#2675
When working with scenarios in Flutter web where we need to address the current version which is cached in the users browser, we do not have any easy way to get that version. The tool package_info_plus may give is a version, but that one is bound to the /version.json on the web site's server, not the actual version of the cached code on the users browser.
Proposal
It would have been VERY convenient to have access to the pubspec.yaml version string during build, so you could address that version as "staticVersion" or " cachedVersion" during run-time. This would make version-checking very easy, and you could address proper ways to refresh your page, either automatically or suggested actions for the user, when the page version on server changes.
My suggestion is to have a global variable i.e. like String cachedVersion and Int cachedBuild int the form "x.y.z+build" and build, which is populated during build time from the values which are presended in the version parameter in pubspec.yaml.
Theese values should be incorporated in the code, so it shouldn't be taken from \version.json in the same way as package_info_plus does, which now follows the version presented on the server, not currently cached in the browser.
Use case
This underlying problem for my suggestion is in theese links:
#104509
fluttercommunity/plus_plugins#2675
When working with scenarios in Flutter web where we need to address the current version which is cached in the users browser, we do not have any easy way to get that version. The tool package_info_plus may give is a version, but that one is bound to the
/version.jsonon the web site's server, not the actual version of the cached code on the users browser.Proposal
It would have been VERY convenient to have access to the
pubspec.yamlversion string during build, so you could address that version as "staticVersion" or " cachedVersion" during run-time. This would make version-checking very easy, and you could address proper ways to refresh your page, either automatically or suggested actions for the user, when the page version on server changes.My suggestion is to have a global variable i.e. like
String cachedVersionandInt cachedBuildint the form "x.y.z+build" and build, which is populated during build time from the values which are presended in the version parameter inpubspec.yaml.Theese values should be incorporated in the code, so it shouldn't be taken from
\version.jsonin the same way aspackage_info_plusdoes, which now follows the version presented on the server, not currently cached in the browser.