Describe the bug
I am managing Dart/Flutter SDKs with nix and direnv, but the same issue also happens when manually managing SDKs.
When I change my SDK for a project (using nix or manually), I change 3 env vars:
PATHDART_ROOTFLUTTER_ROOT
to point to their respective directories in the flutter SDK.
This works perfectly for the command line and for the first time VSCode opens the project.
The issue is that when I change those env vars and VSCode had already opened the project before, it'll continue to use the previous SDK.
This is because the path to the previous SDK is stored in .dart_tool/package_config.json and is used in priority to the 3 env vars I set.
Deleting this file forces VSCode to use the 3 env vars but will unfortunately recreate this file with the new paths hardcoded again.
@DanTup explained why the current behavior exists: dart-lang/sdk#52947 (comment)
Expected behavior
VSCode should always use the paths from those env vars and never store those paths because they might get out of sync with the user choice of SDK.
- Operating System and version: NixOS 25.11
- VS Code version: 1.106.3
- Dart extension version: 3.124.1
- Dart/Flutter SDK version: 3.40.0-0.1.pre