XY6
XY6

Reputation: 3660

Where is Dart's SDK located within /flutter folder?

Software

MacOS Sierra 10.12.6
Android Studio 3.1.2
Flutter 0.3.2 • channel beta
Tools • Dart 2.0.0-dev.48.0.flutter-fe606f890b
Flutter doctor (no problems found)

Problem

Dart's SDK is supposed to be bundled when Flutter is downloaded according to the documentation:

"The Dart SDK is bundled with Flutter; it is not necessary to install Dart separately"

However, I opened an existing Flutter project with Android Studio and it suggested me to either "Download Dart SDK" or "Open Dart settings":

Image of Android Studio suggesting to "download Dart SDK"

Apparently, I need to "Open Dart settings" and tell Android Studio where to find the Dart' SDK. However, it can't find it within the flutter/ directory.

Upvotes: 167

Views: 141564

Answers (15)

Falchio
Falchio

Reputation: 658

If Android Studio show - Error: Dart SDK is not configured.

Linux

Open Linux console and write: flutter sdk-path. Copy output.
Next Settings (Ctrl+Alt+S) => Languages & Frameworks => Flutter => Flutter SDK path.
Paste SDK path.

Windows

If you are using Windows, then the path to dart-sdk can be found with the command flutter doctor -v.

output:

C:\Users\MyUserName>flutter doctor -v
[✓] Flutter (Channel stable, 3.22.1, on Microsoft Windows [Version 10.0.19045.4412], locale en-EN)
    • Flutter version 3.22.1 on channel stable at C:\Users\MyUserName\flutter

Next, copy the path to flutter, in this case it is C:\Users\MyUserName\flutter and add \bin\cache\dart-sdk\bin part.
The result should be
C:\Users\MyUserName\flutter\bin\cache\dart-sdk\bin.

Upvotes: 2

jaspreet Singh
jaspreet Singh

Reputation: 328

Try installing the Android Studio Preview version. I was able to resolve the issue after a day of troubleshooting. The problem was related to Android Studio Koala on my MacBook Pro M1, although it worked fine on a MacBook Air M1.

Upvotes: 0

For everyone who has the Flutter Version Management (FVM) installed on Mac computer, this is the path for the Dart SDK:

/Users/{your_username}/fvm/default/bin/cache/dart-sdk

Upvotes: 0

gjlmotea
gjlmotea

Reputation: 101

You can choose on of dart or flutter path, because flutter package include dart sdk. Or you could install dart standalone.

From "dart"

(Windows)

choco install dart-sdk (ensure Dart installed)

Dart SDK path is: C:\tools\dart-sdk

(macOS)

brew install dart (ensure Dart installed)
brew info dart

Dart SDK path is: /opt/homebrew/Cellar/dart/x.x.x/libexec

From "flutter"

(Windows)

(ensure flutter installed and $PATH configured)

where flutter
and you will get {path_to_directory}\flutter\bin\flutter

Dart SDK path is: {path_to_directory}\flutter\bin\cache\dart-sdk

Flutter SDK path is: {path_to_directory}\flutter

(macOS)

(ensure flutter installed and $PATH configured)

brew info flutter

Dart SDK path is: /opt/homebrew/Caskroom/flutter/x.xx.x/flutter/bin/cache/dart-sdk

Flutter SDK path is: /opt/homebrew/Caskroom/flutter/x.xx.x/flutter


For those who want to create a new Dart Project:

create Dart project

For those who want to create a new Flutter Project:

create Flutter project - dart sdk

create Flutter project - flutter sdk

Upvotes: 9

Taha Malik
Taha Malik

Reputation: 2391

If someone is looking for the path to flutter sdk in Linux I found mine here

/home/your_username/flutter/common/flutter/ flutter path /home/your_username/flutter/common/flutter/bin/cache/dart-sdk dart path

Upvotes: 14

rwalus
rwalus

Reputation: 73

Check this:

brew info dart

Output:

Please note the path to the Dart SDK: /opt/homebrew/opt/dart/libexec

Upvotes: 4

PapiHack
PapiHack

Reputation: 1

Sometimes it is the build directory that he cannot create, suddenly devtools crashes, you can simply recreate it in $HOME/.pub-cache/hosted/pub.dartlang.org/devtools-your-version, then give it the right rights with for example sudo chown -R $USER:$USER $HOME/.pub-cache/hosted/pub.dartlang.org/devtools-your-version/build after re-creating the build directory

Upvotes: 0

chitter
chitter

Reputation: 27

Everyone that is still searching for the correct answer should checkout this answer https://stackoverflow.com/a/63409260/9823820.

If you have the flutter SDK installed.

Run:

flutter doctor -v

The first line will show the install path.

Credits go to @Lee Higgins

Upvotes: 0

Stefan Rein
Stefan Rein

Reputation: 9062

Run brew info flutter

Then you get the path: e.g. /opt/homebrew/Caskroom/flutter/2.5.3

And there the bin/cache has the dartk-sdk:

/opt/homebrew/Caskroom/flutter/2.5.3/flutter/bin/cache/dart-sdk

Upvotes: 6

Abu Yousuf
Abu Yousuf

Reputation: 6107

I have downloaded flutter sdk via homebrew

For Mac OS: 10.14.5

Android Studio version : Arctic Fox 2020.3.1

Flutter sdk location is /usr/local/Caskroom/flutter/2.5.0/flutter

Dart location: /usr/local/Caskroom/flutter/2.5.0/flutter/bin/cache/dart-sdk

Upvotes: 12

AndrewS
AndrewS

Reputation: 543

After installing flutter however you choose.

  1. run the following command

flutter sdk-path

  1. In Android-Studio select File->Setting->Languages & Frameworks->Flutter (assuming you have installed teh flutter plugin)

  2. Populate the "Flutter SDK path:" with the result from (1).

  3. Click apply. The Dart SDK should automatically get populated.

For my installation the values are:

Flutter SDK path: /home/andrew/snap/flutter/common/flutter

Dart SDK path: /home/andrew/snap/flutter/common/flutter/bin/cache/dart-sdk

Upvotes: 12

Malkhan Singh Gaur
Malkhan Singh Gaur

Reputation: 189

I have faced this issue,

  1. Go to the folder where you have downloaded flutter and then delete the flutter folder.

  2. Go to your download folder and where you have downloaded the flutter the first time.

  3. Extract this file again where you have deleted the flutter...

This is working for me.

Upvotes: 0

Roc Boronat
Roc Boronat

Reputation: 12171

If you installed Dart on Windows via Chocolatey, you will find it on C:\tools\dart-sdk

Upvotes: 1

Danny Tuppeny
Danny Tuppeny

Reputation: 42423

The Dart SDK lives inside the bin/cache/dart-sdk folder of the Flutter SDK. It will be downloaded the first time you run the flutter command, so may not exist if you've not yet run flutter.

Upvotes: 227

XY6
XY6

Reputation: 3660

The Dart's SDK is located at /flutter/bin/cache/dart-sdk

However, If Android Studio's flutter plugin is installed, the plugin needs to be told where flutter's SDK is located. Android Studio should be able to locate Dart's SDK afterwards:

enter image description here

Upvotes: 124

Related Questions