question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dart-Code could be able to use flutter packages get instead of pub get

See original GitHub issue

There’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:closed
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
DanTupcommented, May 12, 2017

I’m not so sure that’s the problem, as I’ve set "dart.sdkPath": "C:/flutter/bin/cache/dart-sdk" and still run into the issue.

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).

As for detecting the line, I thought about that route, but don’t know the first thing about how VS Code & Dart-Code actually work

The entry point is activate in extension.ts. The first thing it does is call util.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 calling util.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?

0reactions
DanTupcommented, May 12, 2017

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! 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found