Where is Dart's SDK located within /flutter fo

2020-06-30 08:48发布

问题:

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":

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.

回答1:

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.



回答2:

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: