flutter / flutter-intellij

Flutter Plugin for IntelliJ
https://flutter.dev/using-ide
BSD 3-Clause "New" or "Revised" License
1.95k stars 311 forks source link

Flutter includes a Dart SDK, but IntelliJ is asking me to set a Dart SDK #364

Closed sethladd closed 7 years ago

sethladd commented 7 years ago

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

sethladd commented 7 years ago

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

alexander-doroshko commented 7 years ago

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

sethladd commented 7 years ago

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?

pq commented 7 years ago

@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...)

pq commented 7 years ago

I don't have the Flutter plugin installed

flutter doctor should yell at you then right?

sethladd commented 7 years ago

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)

pq commented 7 years ago

Did you create a project or open an existing one?

sethladd commented 7 years ago

Opened an existing project.

pq commented 7 years ago

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.

sethladd commented 7 years ago

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

pq commented 7 years ago

You forgot:

4) install darcula theme

pq commented 7 years ago

but really, (1) should have prompted a different

2) install the Flutter plugin (because the IDE told me to)

sethladd commented 7 years ago

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 ?

pq commented 7 years ago

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.

alexander-doroshko commented 7 years ago

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

pq commented 7 years ago

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.

pq commented 7 years ago

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

mit-mit commented 7 years ago

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

pq commented 7 years ago

Ah, right. That's a great improvement. 👍

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

Shajeel-Afzal commented 6 years ago

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

sethladd commented 6 years ago

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?

Shajeel-Afzal commented 6 years ago

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.

sethladd commented 6 years ago

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

devoncarew commented 6 years ago

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!

Shajeel-Afzal commented 6 years ago

Sure, I will create a separate issue.

feresr commented 6 years ago

I'm facing this issue as well

saviour123 commented 6 years ago

The solution:

marcvleeuwen commented 6 years ago

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

sekitaka commented 6 years ago

I had the same problem. Now I solved.

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

iamonuwa commented 6 years ago

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

adnanbup commented 5 years ago

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

Santhosh-Srini commented 5 years ago

@iamonuwa Thanks man, that worked for me.

RitamChakraborty commented 5 years ago

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

alexlovar commented 5 years ago

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

wasjunior commented 5 years ago
  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 Files\Dart\dart-sdk when setting up the Dart SDK path in IntelliJ Good Luck
amorenew commented 4 years ago

it is in this path Flutter_SDK\bin\cache\dart-sdk\bin

RitamChakraborty commented 4 years ago

it is in this path Flutter_SDK\bin\cache\dart-sdk\bin

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

ArpitSachan commented 4 years ago

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

abdullahbasaad commented 3 years ago

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.

govindowlok0 commented 3 years ago

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

thank you brother you save me time

meghadri commented 3 years ago

Encountered this with the Dart and Flutter plugins installed before opening an existing flutter project. IntelliJ IDEA 2021.1 (Community Edition) Build #IC-211.6693.111, built on April 6, 2021 Runtime version: 11.0.10+9-b1341.35 amd64 VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o. Windows 10 10.0 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 8 Non-Bundled Plugins: Dart (211.6693.108), io.flutter (55.1.5) Kotlin: 211-1.4.32-release-IJ6693.72

exeptionerror commented 2 years ago

[Solved] Dart SDK is not configured