131

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.

XY6
  • 3,082
  • 4
  • 21
  • 26
  • 28
    The Dart SDK bundled with flutter is located in the folder `flutter/bin/cache/dart-sdk/bin`. However, if you have the Flutter plugin installed and are in a Flutter project you should not need to configure this. – Jonah Williams May 14 '18 at 03:19
  • 1
    The plugin was already installed https://i.imgur.com/ggToUXX.png – XY6 May 14 '18 at 03:39
  • 2
    Thanks, I updated the flutter SDK path and it's working now. – XY6 May 14 '18 at 03:52
  • Yesterday in first time installed dart via brew, try to find dart sdk via IntelligeIDE but didnt found... – Nikolay Baranenko Apr 06 '22 at 06:40

12 Answers12

187

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.

Danny Tuppeny
  • 40,147
  • 24
  • 151
  • 275
  • So I must manually add a specific path to `dart-sdk` to `.zshrc` file? – Anatoly Jul 15 '20 at 15:25
  • 1
    @Anatoly generally, no - you should not add that path to your PATH explicitly. Generally you will use the `flutter` command so you shouldn't need this on `PATH`. Upcoming versions of Flutter will include a `dart` binary in the normal `bin` folder so that you can use `dart` from the command line easily. – Danny Tuppeny Jul 16 '20 at 17:13
  • Hi there ! If I just happened to want to call the dart sdk, I could add bin/cache/dart-sdk to .zshrc file? – Gene Feb 16 '21 at 20:05
  • update, yes you can manually add a path to the dart-sdk in flutter and get access to dart from the command line ! – Gene Feb 16 '21 at 20:22
  • export PATH="$PATH:/Users/gene/development/flutter/bin/cache/dart-sdk" – Gene Feb 16 '21 at 20:22
  • Linux, snap install: `$HOME/snap/flutter/common/flutter/bin/cache/dart-sdk` – Benoit Duffez Nov 23 '22 at 16:19
109

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

XY6
  • 3,082
  • 4
  • 21
  • 26
  • 3
    I have flutter-sdk and flutter plugin installed, yet when I imported a dart library project, I still had to point idea to dart sdk folder just like the author of the original question... – morgwai May 22 '21 at 16:09
  • What @morgwai has replied is right, we still need path and Thats "/bin/cache/dart-sdk" Abu Yosuf replied – Deepak Ghadi Jan 28 '22 at 11:14
12

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

Abu Yousuf
  • 5,729
  • 3
  • 31
  • 50
12

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

Taha Malik
  • 2,188
  • 1
  • 17
  • 28
8

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

AndrewS
  • 413
  • 4
  • 6
4

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

Stefan Rein
  • 8,084
  • 3
  • 37
  • 37
3

Check this:

brew info dart

Output:

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

rwalus
  • 63
  • 7
1

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

Roc Boronat
  • 11,395
  • 5
  • 47
  • 59
0

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.

Akif
  • 7,098
  • 7
  • 27
  • 53
0

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

0

If Android Studio show - Error: Dart SDK is not configured.
Open console and write: flutter sdk-path. Copy output.
Next Settings (Ctrl+Alt+S) => Languages & Frameworks => Flutter => Flutter SDK path.
Paste SDK path.

Falchio
  • 174
  • 1
  • 14
-1

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

chitter
  • 19
  • 5