Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i change my dart-sdk on VSCode

i have been using flutter recently and i really wanted to use Jaguar for my project. But here is the catch, the flutter sdk brought dart with version 2.0.0-dev-58.0 but jaguar said they need dart sdk with version 2.0.0-dev-65.0

Okay, so i get myself dart with sdk version of 2.1.0-dev.1.0, but my vscode can't seem to recognize that i have installed the sdk.

Any ideas on how to change that?

like image 701
revhounds Avatar asked Aug 18 '18 10:08

revhounds


2 Answers

It's quite easy if you use VSCode:

  1. Clone flutter repo to a new folder:
mkdir ~/flutter_dev
cd ~/flutter_dev
git clone https://github.com/flutter/flutter.git .
  1. Open your workspace preferences and update dart.flutterSdkPath setting:
"settings": {
  "dart.flutterSdkPath": "/Users/youruser/flutter_dev"
}
  1. Restart VSCode and you're good to go.

See more info in Dart Code - Quickly Switching Between SDK Versions

like image 109
Andrey Gordeev Avatar answered Sep 23 '22 12:09

Andrey Gordeev


The Dart Code plugin has a setting dart.sdkPath

The location of the Dart SDK to use for analyzing and executing code. If blank, Dart Code will attempt to find it from the PATH environment variable. When editing a Flutter project, the version of Dart included in the Flutter SDK is used in preference.

There's also dart.sdkPaths which allows quick switching between alternatives.

For Flutter projects, use dart.flutterSdkPath(s)

like image 20
Richard Heap Avatar answered Sep 25 '22 12:09

Richard Heap