Skip to content

Demote .dart_tool/package_config.json to after PATH when searching for an SDK - #6109

Merged
DanTup merged 1 commit into
masterfrom
prefer-sdk-from-path-over-package-config
Jul 2, 2026
Merged

DanTup merged 1 commit into
masterfrom
prefer-sdk-from-path-over-package-config

Conversation

@DanTup

@DanTup DanTup commented Jul 2, 2026

Copy link
Copy Markdown
Member

Fixes #5844

Also see #4607

@DanTup DanTup added this to the v3.140.0 milestone Jul 2, 2026
@DanTup DanTup added is enhancement An enhancement or improvement that should be listed in release notes but is not a bug fix. in flutter Relates to running Flutter apps labels Jul 2, 2026
@DanTup
DanTup requested a review from Copilot July 2, 2026 14:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates Flutter SDK discovery to prefer SDKs available on the user’s PATH over the Flutter SDK path inferred from .dart_tool/package_config.json, addressing scenarios where users switch SDKs via environment changes (eg. nix/direnv) but the extension continues using a previously-cached SDK reference.

Changes:

  • Reorders Flutter SDK search paths so .dart_tool/package_config.json-derived SDK paths are only used after PATH.
  • Adds an explanatory comment noting .dart_tool/package_config.json is now a fallback and that Pub status checks will detect mismatches and prompt a rerun.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/extension/sdk/utils.ts Outdated

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adjusts the SDK search path order in src/extension/sdk/utils.ts by moving the extraction of the Flutter SDK path from the packages file to be a fallback after the user's PATH. This ensures that changes to the SDK on the user's PATH are prioritized. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@DanTup
DanTup force-pushed the prefer-sdk-from-path-over-package-config branch from 3cbb577 to ca89c4b Compare July 2, 2026 14:18
@DanTup
DanTup merged commit 4c4f50c into master Jul 2, 2026
21 checks passed
@DanTup
DanTup deleted the prefer-sdk-from-path-over-package-config branch July 2, 2026 14:18
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 enhancement An enhancement or improvement that should be listed in release notes but is not a bug fix.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prefer Flutter SDK from PATH before one read from a .dart_tool/package_config.json

2 participants