[package_info_plus]: Use Flutter's compile-time build name/number on web instead of version.json
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 25/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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).
- Lingua principale
- Dart
- Stelle
- 1.9k
- Fork
- 1.3k
- Merge medio
- 6g 16h
- PR unite (30g)
- 16
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di fluttercommunity/plus_plugins
-
[Bug]: (share_plus) iOS drops the subject when sharing a uriForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertabug triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
fluttercommunity/plus_plugins#3994 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement triage
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
fluttercommunity/plus_plugins#3976 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
fluttercommunity/plus_plugins#3974 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement triage
Difficoltà 5/5 Più di una settimana Idoneità per principianti 48/100
fluttercommunity/plus_plugins#3973 ·
I maintainer di solito rispondono entro 1 giorno
-
bug triage
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
fluttercommunity/plus_plugins#3968 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di fluttercommunity/plus_plugins
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
linagora/twake-on-matrix#3435 ·
I maintainer di solito rispondono entro 3 giorni
-
右下角的图标问题Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
[Domain Activation] Show a user-friendly error when sending is blocked pending domain activationAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
linagora/tmail-flutter#4953 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
genkit-ai/genkit-dart#587 ·
I maintainer di solito rispondono entro 1 giorno