Flutter-intellij: Flutter includes a Dart SDK, but IntelliJ is asking me to set a Dart SDK

Created on 21 Oct 2016  路  40Comments  路  Source: flutter/flutter-intellij

We shouldn't have to ask users to configure the Dart SDK if they have opened a Flutter project. The version of Flutter bundles/downloads a version of the Dart SDK. No further configuration should be required. Asking a user to further configure their IDE increases the chances of them using the wrong Dart SDK.

Here's a screenshot of my IDE, immediately after restarting after installing the Dart plugin:

screen shot 2016-10-21 at 1 43 10 pm

dart plugin topic-getting-started

Most helpful comment

You forgot:

4) install darcula theme

All 40 comments

Here is the screen where I'm supposed to set the Dart SDK. It would be fantastic if there was a "use the version from Flutter" so I don't have to hunt down wherever Flutter downloaded the Dart SDK

screen shot 2016-10-21 at 1 47 11 pm

tldr: I don't know how to set this :(

According to the screenshot Flutter plugin is not installed. IDE has no idea where Flutter SDK is.

With my pull request accepted user will have no chance to get empty 'Dart SDK path' in Dart page if Flutter SDK is set in Flutter page.
//cc @pq

Good call. I don't have the Flutter plugin installed. Not sure what to do about that. Maybe there's a search algorithm to find a Dart SDK?

@sethladd: if you have the Flutter plugin installed it will prompt you for a Flutter SDK location (e.g., repo root) and set the Dart SDK for you. You should never have to go to the Dart preference page. (In this case Dart is a detail of Flutter...)

I don't have the Flutter plugin installed

flutter doctor should yell at you then right?

I just installed the Flutter plugin. I haven't been asked to set my Flutter SDK yet. The IDE is still telling me to set Dart SDK:

screen shot 2016-10-21 at 2 30 46 pm

(this is after a restart and after I changed the project to be a Flutter project)

Did you create a project or open an existing one?

Opened an existing project.

OK, that's what I'd expect. To fix this, we'd need the Dart plugin to be smarter.

cc @alexander-doroshko

The flow I was describing starts with you:

  1. installing the flutter plugin
  2. creating a flutter project, wherein you are asked for an SDK location

Opening an existing project skips the second step and so the Dart plugin sees the Dart file and intervenes.

I did:

1) open an existing project
2) install the dart plugin (because IDE told me to)
3) install the flutter plugin (because @pq told me to :)

You forgot:

4) install darcula theme

but really, (1) should have prompted a different

2) install the _Flutter plugin_ (because the IDE told me to)

Yes, ideally, if a user opens a Flutter codebase in IntelliJ for the first time, they should be prompted to install the Flutter plugin. That would be great.

Can you look for flutter.yaml ?

We have logic like that _in the Flutter plugin_ that helps migrate projects that weren't created with the Flutter wizard to having the Flutter module type and so being treated as a Flutter project. It would be awesome to embed similar logic in IntelliJ.

The logic that @alexander-doroshko described that you get from the platform I think would only kick in if flutter.yaml were opened and I don't know how frequently that happens in practice. Something more comprehensive (like scanning for the existence of that file) would have to happen programmatically in an installed plugin. In theory we could embed this logic into the Dart plugin but I'll defer to @alexander-doroshko about how he feels about that.

Looks like there are no ways to automatically get advertising of the Flutter plugin from the IntelliJ Platform.

Thanks for confirming @alexander-doroshko.

From the other thread it sounds like the best we could do is add some awareness to the Dart plugin. Something to add to the general discussion around how these plugins should interact.

Another "getting started" flow to consider. As @sethladd suggests:

Yes, ideally, if a user opens a Flutter codebase in IntelliJ for the first time, they should be prompted to install the Flutter plugin. That would be great.

FYI @mit-mit

That is the change I landed to IntelliJ, I believe: https://github.com/JetBrains/intellij-community/pull/496

Ah, right. That's a great improvement. 馃憤

Closing in favor of revisiting (if needed) once we dig deeper into the getting started flow.

@sethladd is your problem solved? If yes then please share your solution.

Sorry, it's been a long time. Are you still experiencing the issue?

From my expectations, when you install the Flutter plugin, it should auto-detect the Dart SDK which is part of your Flutter SDK.

@mit-mit might be able to confirm that expectation?

Yup, I am still facing this problem. My Intellij IDEA version is 2017.2.3 and flutter plugin is installed in it already. I am facing this problem while trying to open the flutter gallery example available in the flutter directory.

Would you be willing to open a new bug, with screenshots?
Thanks!

I am facing this problem while trying to open the flutter gallery example available in the flutter directory.

We do test that w/ each release but it's possible it's regressed (or, you're seeing something more specific to your setup). As Seth said, can you file a separate bug? Thanks!

Sure, I will create a separate issue.

I'm facing this issue as well

The solution:

  • Clone the flutter repo as specified on the installation guide.
    git clone -b beta https://github.com/flutter/flutter.git
  • install flutter and dart plugins for Intellij
  • close all existing project a create a new project.
  • in the intellij project template choose flutter.
  • your sdk path is the flutter directory you clone.
  • sit and observe intellij install, dart, flutter and all the sdk and its dependencies, it would also install some android tools.

I can confirm that this is still an issue for version 2018.1.2

I had the same problem.
Now I solved.

You should set Preferences -> Language and Framework -> Flutter -> Flutter SDK Path .

Your Dart SDK is inside the Flutter directory. My Flutter directory was inside /opt/ hence, my dart sdk path = /opt/flutter/bin/cache/dart-sdk

select the path from flutter sdk folder flutter>bin>cache>dart-sdk

@iamonuwa Thanks man, that worked for me.

Download the dart SDK form here
Extract the zip in a specfic folder
Locate the folder in Intellij IDEA
screenshot from 2018-08-26 10-43-57

I had the same problem after importing a flutter project from git. These are the steps to solve the problem.

File->Settings->Language & Framework->Flutter
Choose flutter SDK path: the first time we install flutter, we choose the location where the flutter should be installed. Choose this location.
Click OK and the android studio will refresh. Carry on if the problem is solved.
If you are still stuck with the error.
Goto this link and install Dart.
Goto the same place in settings, ..Language & Framework->Dart and chose the SDK location.
This solved the issues for me.
take from: https://stackoverflow.com/a/49684442/4799284

  1. Just install Dart SDK from https://www.dartlang.org/tools/sdk#install-using-a-setup-wizard
  2. Make sure you install it in its own folder eg C:Dart
  3. Navigate to to the SDK folder eg C:Program FilesDartdart-sdk when setting up the Dart SDK path in IntelliJ
    Good Luck

it is in this path Flutter_SDKbincachedart-sdkbin

it is in this path Flutter_SDKbincachedart-sdkbin

Yes, it is. You can also download it from Dart Achive, but this does not contain libraries like meta.

File->Setting->Language & Framework->flutter
choose Flutter SDK path (where you Downloaded the flutter plugin, choose flutter folder).
It ill work for sure.

you can just run flutter upgrade

Guys, the solution is 馃憤
1- download flutter from the link https://flutter.dev/docs/get-started/install/windows#get-the-flutter-sdk
2- Extract the zip file in a specific path.
3- Go to Android studio ==> settings ==> Flutter sdk path, update it with a new path you created.

then you can get dependencies automatically to install it.

Was this page helpful?
0 / 5 - 0 ratings