How can i change my dart-sdk on VSCode

10,881

Solution 1

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

Solution 2

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)

Solution 3

I want to add one more things to @Andrey, you can use FVM to install as much as you want versions and channels, it's easy to install and manage versions. It hold all versions on your home directory, I think it's easier than managing with Git.

Share:
10,881
Admin
Author by

Admin

Updated on July 07, 2022

Comments

  • Admin
    Admin almost 2 years

    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?