Dart-Code could be able to use flutter packages get instead of pub get
See original GitHub issueThere’s a problem currently between Dart and Flutter, and no one seems to really know whose problem it is, so they’re suggesting passing it to the editors. See: flutter/flutter#6284
When a project has flutter: sdk: flutter
in its pubspec.yaml, pub get
fails with exit code 69.
My plan of attack for this is to follow the template of f7513f95ef72acf49c8eefae58a077aaf3b177bd and make a new dart.flutterProject
option, and in sdk.ts inside of the on-save hook for pubspec.yaml, have it check whether dart.flutterProject
is enabled and run flutter packages get
instead.
If that sounds correct to you, I’ll crank it out today.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Saving pubspec runs `pub get` instead of `flutter packages get ...
I am unable to use the custom fonts because my pubspec.yaml file wouldn't save without an error for some reason.
Read more >Using packages - Flutter documentation
The pub.dev site lists many packages—developed by Google engineers and generous members of the Flutter and Dart community— that you can use in...
Read more >Flutter users should run `flutter packages get` instead of `pub ...
Go to the top menu 'Tools > Flutter >flutter package get and click on it ,it will find the things those are missing....
Read more >dart pub get
Use dart pub get to retrieve the dependencies used by your Dart application. ... Once the dependencies are acquired, they may be referenced...
Read more >Commands - Dart & Flutter support for Visual Studio Code
Dart Code adds a number of commands to the command palette ( Ctrl + Shift + P ... in a Flutter project this...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry, maybe I confused things. Using that Dart SDK won’t resolve this issue (the need to use
flutter
for package restore), it’s just an additional problem that needs solving for flutter projects. However we decide to detect flutter packages can be used to solve both of these issues (but they will both need individual fixes based on that detection).The entry point is
activate
inextension.ts
. The first thing it does is callutil.findDartSdk()
. Probably before that it should call some code to detect if it’s a flutter project and if so use a special path (instead of callingutil.findDartSdk
, but still using that for non-flutter). That would probably be the fix for #286.Further down, where we register SDK commands we could possibly pass in that flag that says it’s a flutter project into
SdkCommands
and then it can perform different logic for the commands if flutter.Finally, the file watcher on pubspec could be tweaked to re-detect flutter SDK and if if the value changes (either it was flutter and now is not, or vice versa) then prompt the user to reload similar to when analyzer settings change.
What do you think?
Yeah, sure. However if you’re starting from scratch, it’s possible your pubspec wouldn’t have
sdk: flutter
in it when the extension activated so it might be confusing to the user why things aren’t working.Prompting to reload is fairly trivial to add if the code to detect it exists though. I’ve been hoping to work on #286 this weekend but it’s not going to happen, so any progress you make on this should save me some effort there! 😃