Dart-Code: Don't use dart.sdkPath in preference to Flutter-shipped version of Dart for a Flutter project
Hi, I’m getting an issue with the code. I downloaded the example from VSCode running “Flutter: New Project” and it immediately marked as an error a part of code that Android Studio does not. The incriminated part is
floatingActionButton: new FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: new Icon(Icons.add), //this line
)
It can’t be an error because it compiles and runs just fine. Also I get plenty of similar errors in another test project I made, errors I don’t get in Android Studio. Is there a way to solve this? Am I missing something? The debugger works fine.
I’m running VSCode x64 1.25.1 on Windows 10 Pro
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (8 by maintainers)
No worries, I think you’ve hit a legit issue. Setting
dart.sdkPath
has become more common due to all sorts ofPATH
issues (settingPATH
so that it applies outside of the terminal turns out to be complicated on some OSes) so us using it ahead of the Flutter version is probably a bad idea. It was handy for me in the past for testing, but having them mismatch causes other issues anyway.So, I’m going to use this issue as a task to stop prioritising
dart.sdkPath
over the embedded one. If anyone wants to change the Flutter Dart SDK version (which they almost certainly don’t), they can rig it themselves internally.Thanks for the help debugging; and do shout if you have any other issues!
You should be able to just run
flutter channel dev
and thenflutter upgrade
. See https://github.com/flutter/flutter/wiki/Flutter-build-release-channels(To change back, you can do
flutter channel beta
andflutter upgrade
)