New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Get Packages" commands should not include example folder implicitly #4709
Comments
I think this is because @sigurdm does this seem like a Pub bug? Should pub do this when the example is Flutter if it's running without Flutter? As a fix for VS Code, I think I should probably pass |
Oh, I think I see - I think @pattobrien can you confirm if this only happened because you created the If so, the fix is probably to ensure we detect when a Flutter project appears in a Dart-only workspace and re-initialize (which will have the effect of selecting the Flutter SDK instead of a pure Dart SDK). |
@DanTup the issue is reproducible both when creating the projects via VSCode terminal and in a different terminal (Kitty). The problem also persists even after restarting VSCode. However, running ❯ dart pub get
Resolving dependencies...
Got dependencies!
Resolving dependencies in ./example...
Got dependencies in ./example. |
I think we should definitely add |
Are you sure this is happening, and it's not that:
That's the behaviour I see (minus the error from the first step) and that I expect. (I've pushed a fix to use --no-example anyway, because we handle nested folders directly ourselves and don't want to duplicate work) |
Interesting.. I do have some third-party tools installed - namely fvm for managing flutter versions - so perhaps this is a configuration issue (though I did check my settings before submitting the issue). I'll still keep an eye out for possible causes, in case its of value. Thanks for pushing such a quick fix! |
If you're able to confirm whether this is what's doing it, I'd be interested to know. If the It does feel like there's a bug here somewhere, but I don't know whose it is 🙃 |
Okay, I was able to track down and fix the issue and find a way to reproduce it somewhat, by changing the # "Cant find Flutter SDK" appears when using tilde:
export FLUTTER_ROOT="~/.fvm/default"
# Fixed by using $HOME variable:
export FLUTTER_ROOT="$HOME/.fvm/default" From a brief lookup, the tilde is allowed syntax for zsh, but seems like Dart Code fails to parse that path properly. Here's all of the Flutter and Dart-related exports in my zsh config: # Flutter and Dart setup
export PATH="$PATH:${HOME}/.fvm/default/bin"
export PATH="$PATH:${HOME}/.fvm/default/bin/cache/dart-sdk/bin"
export PATH="$PATH":"$HOME/.pub-cache/bin"
export PATH="${HOME}/Library/Android/sdk/tools:${HOME}/Library/Android/sdk/platform-tools:${PATH}"
export PATH="$JAVA_HOME/bin:$PATH"
export PUB_CACHE="$HOME/.pub-cache"
export FVM_HOME="$HOME/.fvm"
export FLUTTER_ROOT="$HOME/.fvm/default" # line which fixed the issue And my Dart Code-related VSCode settings: {
"dart.addSdkToTerminalPath": true,
"dart.projectSearchDepth": 5,
"dart.flutterSdkPath": "~/.fvm/default",
"dart.flutterSdkPaths": ["~/.fvm/versions/"],
"dart.checkForSdkUpdates": false,
"dart.flutterGenerateLocalizationsOnSave": "allIfDirty",
"dart.runPubGetOnNestedProjects": "both",
"dart.renameFilesWithClasses": "prompt",
"dart.previewFlutterUiGuides": true,
"dart.showInspectorNotificationsForWidgetErrors": false,
"dart.debugExternalPackageLibraries": true,
"dart.debugSdkLibraries": true,
"dart.warnWhenEditingFilesInPubCache": false,
...
} |
Not sure it is a bug really.
I believe If you want to develop on the package with a non-flutter sdk (and thus be unable to test the example), you'll have to resort to For Dart Code I think it makes some sense to always use |
@pattobrien thanks for digging!
I don't think Dart-Code is doing anything with this variable, I think it's
So I think you should either remove the quotes or use @sigurdm thanks - I also think there's probably no bug here now.
Yep, understood. It can always be slower because we might call this 10 times if the workspace has 10 projects in. If pub gets a batch mode that would let us provide a bunch of folders (which may or may not be nested) that would definitely speed things up but I don't know how worthwhile that is. The only time I really notice this taking a while is if I open the Flutter repo and it needs running for every folder 😄 |
Description
With a Dart package at root, and a nested Flutter example package, running Dart Code's
pub get
command (via pubspec save) fails with error 69. See https://github.com/pattobrien/nested_package_bug to reproduce.Steps to Reproduce
example
.pub get
via Dart Code (VSCode extension).Observed Result
Additional Info
Dart Code extension v3.70.0
The text was updated successfully, but these errors were encountered: