Skip to content

Always run Flutter initialization (using flutter --help) to ensure it's up-to-date - #5982

Merged
DanTup merged 2 commits into
masterfrom
always-initialize-flutter
Mar 12, 2026
Merged

DanTup merged 2 commits into
masterfrom
always-initialize-flutter

Conversation

@DanTup

@DanTup DanTup commented Mar 12, 2026

Copy link
Copy Markdown
Member

If the local Flutter SDK has recently been upgraded, the Dart SDK on-disk might be out of date and the first invocation of flutter may kick off a download to fix this.

Before this change, if there was a Dart SDK at all, we assumed it was all initialized correctly and proceeded to start up and spawn the analysis server, but this could then crash if Flutter started replacing the Dart SDK at the same time.

With this change, we will always run a flutter command (flutter --help because it's faster than --version which seems to do some other work) before proceeding. In the case where things are good, this may add ~1s to the startup, but this is better than the random failures.

The "Flutter is initializing.." notification is now shown only if the process is still going after 5s, to avoid it showing quickly for everyone in the case of things working normally.

Fixes #5971

…it's up-to-date

If the local Flutter SDK has recently been upgraded, the Dart SDK on-disk might be out of date and the first invocation of `flutter` may kick off a download to fix this.

Before this change, if there was a Dart SDK at all, we assumed it was all initialized correctly and proceeded to start up and spawn the analysis server, but this could then crash if Flutter started replacing the Dart SDK at the same time.

With this change, we will _always_ run a `flutter` command (`flutter --help` because it's faster than `--version` which seems to do some other work) before proceeding. In the case where things are good, this may add ~1s to the startup, but this is better than the random failures.

The "Flutter is initializing.." notification is now shown only if the process is still going after 5s, to avoid it showing quickly for everyone in the case of things working normally.

Fixes #5971
@DanTup DanTup added this to the v3.132.0 milestone Mar 12, 2026
@DanTup DanTup added is bug fix in flutter Relates to running Flutter apps labels Mar 12, 2026
@codecov

codecov Bot commented Mar 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 59.09091% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.55%. Comparing base (d1d61d7) to head (d9e00c1).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/extension/sdk/flutter.ts 58.62% 11 Missing and 1 partial ⚠️
src/extension/analysis/analyzer.ts 22.22% 7 Missing ⚠️
src/extension/sdk/utils.ts 50.00% 3 Missing ⚠️
src/extension/commands/analyzer.ts 0.00% 2 Missing ⚠️
src/shared/vscode/device_manager.ts 0.00% 1 Missing ⚠️
src/shared/vscode/progress.ts 90.00% 1 Missing ⚠️
src/shared/vscode/utils.ts 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5982      +/-   ##
==========================================
+ Coverage   67.52%   67.55%   +0.02%     
==========================================
  Files         169      170       +1     
  Lines       12962    12977      +15     
  Branches     2565     2565              
==========================================
+ Hits         8752     8766      +14     
  Misses       3751     3751              
- Partials      459      460       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DanTup
DanTup marked this pull request as ready for review March 12, 2026 12:53
@DanTup
DanTup requested a review from Copilot March 12, 2026 12:53
@DanTup

DanTup commented Mar 12, 2026

Copy link
Copy Markdown
Member Author

@codex review

/gemini review

gemini-code-assist[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@DanTup
DanTup force-pushed the always-initialize-flutter branch from e4989ed to d9e00c1 Compare March 12, 2026 15:35
@DanTup
DanTup merged commit b146031 into master Mar 12, 2026
25 of 26 checks passed
@DanTup
DanTup deleted the always-initialize-flutter branch March 12, 2026 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in flutter Relates to running Flutter apps is bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Analysis server startup can fail after Flutter upgrade/branch change

2 participants