[package_info_plus]: Use Flutter's compile-time build name/number on web instead of version.json
维护者通常 1 天内回复
评估
调研方向
Start in the package_info_plus web implementation and review its current version.json loading path. Verify the compile-time build values are preferred when available, version.json remains the fallback, and native behavior is unchanged; the linked PR #3990 indicates work is already underway.
由索引模型根据 Issue 内容生成。
描述
Plugin
package_info_plus
Use case
On the web, PackageInfo.fromPlatform() reads version / buildNumber from version.json, fetched from the server at runtime. That file describes the currently deployed bundle, not the one running. A client on a stale cached bundle therefore reports the new version, so update gates and "running version" displays fail for exactly the users they exist for (#2675, closed as not planned). The fetch can also fail outright (#456, #3028).
Since Flutter 3.47.0 (flutter/flutter#187935), flutter_tools injects the app's pubspec version (or --build-name / --build-number) as the dart-defines FLUTTER_BUILD_NAME / FLUTTER_BUILD_NUMBER, exposed as appBuildName / appBuildNumber in package:flutter/services.dart. They are compiled into the bundle, so they always describe the code that is executing.
Proposal
In the web implementation, prefer the compile-time values when present and keep version.json as the fallback:
const _buildName = bool.hasEnvironment('FLUTTER_BUILD_NAME')
? String.fromEnvironment('FLUTTER_BUILD_NAME')
: null;
const _buildNumber = bool.hasEnvironment('FLUTTER_BUILD_NUMBER')
? String.fromEnvironment('FLUTTER_BUILD_NUMBER')
: null;
Reading the defines through bool.hasEnvironment (instead of importing appBuildName) keeps the current minimum Flutter version: older SDKs just don't define them, and behaviour is unchanged. On native platforms nothing changes.
This fixes #2675 transparently for every consumer, including SDKs that derive their release from package_info_plus (for example sentry_flutter's release name).
PR: #3990 (replaces the opt-in approach of #3874, which I closed once the Flutter side landed).
- 主要语言
- Dart
- 星标
- 1.9k
- 派生
- 1.3k
- 平均合并
- 4 天 2 小时
- 30 天内合并 PR
- 15
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
fluttercommunity/plus_plugins 的其他 Issue
-
[Bug]: (share_plus) iOS drops the subject when sharing a uri可能已有人在做 @kaluli123123 于 6 天前认领。 未关闭bug triage
难度 2/5 1-3 小时 新手友好度 82/100
fluttercommunity/plus_plugins#3994 · 1 条评论 ·
维护者通常 1 天内回复
-
[Request]: network_info_plus: use ConnectivityManager for getWifiIP and getWifiGatewayIP from Android 7 (N), so ethernet works below Android 12可能已有人在做 @redge-munch 于 4 天前认领。 未关闭enhancement triage
难度 3/5 半天 新手友好度 22/100
fluttercommunity/plus_plugins#3998 ·
维护者通常 1 天内回复
-
enhancement triage
难度 4/5 3-5 天 新手友好度 55/100
fluttercommunity/plus_plugins#3976 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 35/100
fluttercommunity/plus_plugins#3974 · 1 个 reaction ·
维护者通常 1 天内回复
-
enhancement triage
难度 5/5 一周以上 新手友好度 48/100
fluttercommunity/plus_plugins#3973 ·
维护者通常 1 天内回复
查看 fluttercommunity/plus_plugins 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
aaronified/fluenough#466 ·
维护者通常 1 天内回复
-
difficulty: easy duration: small priority: medium type: bug
难度 2/5 1-3 小时 新手友好度 74/100
duobaseio/forui#1215 · 1 条评论 ·
维护者通常 1 天内回复
-
bug Done
难度 2/5 1-3 小时 新手友好度 66/100
维护者通常 1 天内回复
-
Use getApplicationSupportDirectory() of path_provider instead of getApplicationDocumentsDirectory()未关闭
难度 2/5 1-3 小时 新手友好度 65/100
brandonp2412/Flexify#387 · 2 条评论 ·
维护者通常 1 天内回复
-
fix(very_good_flutter_plugin): Linux plugin does not compile the Pigeon sources可能已有人在做 @marcossevilla 于 2 天前认领。 未关闭bug product: very_good_flutter_plugin
难度 1/5 1-3 小时 新手友好度 78/100
VeryGoodOpenSource/very_good_templates#654 ·
维护者通常 1 天内回复