Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

[package_info_plus]: Use Flutter's compile-time build name/number on web instead of version.json

Aberta
#3,989 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

@Ortes já está trabalhando nisso.

Desde 29/9/2026.

  • #3990 de @Ortes — aberto

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
25/100
Tipo de issue
Funcionalidade
Clareza
Claramente especificada
Status de atividade
Estagnada
Stack de tecnologia
dart, flutter
Domínio
web-dev

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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).

Linguagem predominante
Dart
Estrelas
1.9k
Forks
1.3k
Merge médio
8h 43min
PRs com merge (30d)
13

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de fluttercommunity/plus_plugins

Todas as issues de fluttercommunity/plus_plugins

Issues semelhantes

Mais issues de Dart

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.