flutter-intellij icon indicating copy to clipboard operation
flutter-intellij copied to clipboard

Cannot find declaration to go to

Open aolose opened this issue 6 years ago • 19 comments

Thanks for the feedback! If your issue is related to the Flutter framework itself, please open an issue at github.com/flutter/flutter.

Steps to Reproduce

When Ctrl + Click ,ide shows : Cannot find declaration to go to image

Version info

Please paste the output of running flutter doctor -v here (available from the command line or from Tools > Flutter > Flutter Doctor). It will provide the version of the Flutter framework as well as of the IntelliJ plugin.

[√] Flutter (Channel dev, v0.5.5, on Microsoft Windows [Version 10.0.16299.15], locale zh-CN)
    • Flutter version 0.5.5 at D:\FlutterSDK\flutter
    • Framework revision 020e0ef55c (8 days ago), 2018-06-14 13:17:08 -0700
    • Engine revision c3976b3c71
    • Dart version 2.0.0-dev.61.0.flutter-c95617b19c

[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at D:\AndroidSDK
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-27, build-tools 27.0.3
    • ANDROID_HOME = D:\AndroidSDK
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)
    • All Android licenses accepted.

[√] Android Studio (version 3.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 23.2.1
    • Dart plugin version 171.4424
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b01)

[√] IntelliJ IDEA Ultimate Edition (version 2018.1)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2018.1
    • Flutter plugin version 25.0.2
    • Dart plugin version 181.4203.498

[√] Connected devices (1 available)
    • G8142 • CB512EEZUJ • android-arm64 • Android 8.0.0 (API 26)

• No issues found!

aolose avatar Jun 22 '18 08:06 aolose

emmm... I think I solve it.

  • 1.close your project
  • 2.delete .idea folder and *.iml files in root path
  • 3.open your project

and then i found the *.iml not generated again.

aolose avatar Jun 22 '18 09:06 aolose

@aolose have you solved this problem? I do that as you describe , just can not open my project as a normal flutter project.

StarJiao avatar Dec 19 '18 07:12 StarJiao

emmm... I think I solve it.

  • 1.close your project
  • 2.delete .idea folder and *.iml files in root path
  • 3.open your project

and then i found the *.iml not generated again.

It's not working for me. And the strange thing is other flutter projects are unaffected for now.

baoxiehao avatar Feb 19 '19 03:02 baoxiehao

not solved issue, reopen please

Diaglyonok avatar Apr 05 '19 15:04 Diaglyonok

For people seeing this issue, I would:

  • ensure that a flutter sdk is configured in the settings, Language & Frameworks > Flutter page
  • try the File > Invalidate caches menu item

devoncarew avatar Apr 15 '19 02:04 devoncarew

@Diaglyonok: does @devoncarew's suggestion work for you?

pq avatar Apr 15 '19 14:04 pq

@Diaglyonok: does @devoncarew's suggestion work for you?

No, this is not helps, I found only one solution - recreating the project, but after adding some dependency to pubspec.yaml it repeats again.

Diaglyonok avatar Apr 15 '19 14:04 Diaglyonok

Seems that one of the following actions (or their combination) solves the problem:

  1. having a good git ignore call git clean -xffd My gitignore: https://gist.github.com/Diaglyonok/64adccaf923dc6c7522cab1e89a2fe15
  2. switching flutter channel to any other and back. Commands example (if current channel is stable): flutter channel dev flutter pub get flutter channel stable

after any of these actions: flutter pub get flutter clean flutter run ...

Since this problem does not always appear, at the moment I cannot test these solutions again, if you have such a problem, try this solution and report the result, please.

Diaglyonok avatar Apr 17 '19 14:04 Diaglyonok

solution, that i suggested above (first) just tested and it worked for me again.

Diaglyonok avatar Apr 29 '19 12:04 Diaglyonok

Here's my output from the doctor.... Did a consistent solution ever appear? Thank you!

C:\Users\Blake>flutter doctor -v [√] Flutter (Channel stable, v1.5.4-hotfix.2, on Microsoft Windows [Version 10.0.18362.175], locale en-US) • Flutter version 1.5.4-hotfix.2 at C:\src\flutter • Framework revision 7a4c33425d (9 weeks ago), 2019-04-29 11:05:24 -0700 • Engine revision 52c7a1e849 • Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.0) • Android SDK at C:\Users\Blake\AppData\Local\Android\sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 29.0.0 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01) • All Android licenses accepted.

[√] Android Studio (version 3.4) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin version 37.0.1 • Dart plugin version 183.6270 • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)

[√] IntelliJ IDEA Community Edition (version 2018.2) • IntelliJ at C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2018.2 • Flutter plugin version 31.3.2 • Dart plugin version 182.3569.4

[√] IntelliJ IDEA Community Edition (version 2018.3) • IntelliJ at C:\Program Files\JetBrains\IntelliJ-CE-2018.3.4 • Flutter plugin version 37.0.1 • Dart plugin version 183.6270

[√] VS Code (version 1.35.1) • VS Code at C:\Users\Blake\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.2.0

[√] Connected device (1 available) • Android SDK built for x86 • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

• No issues found!

blakesaradad avatar Jul 04 '19 05:07 blakesaradad

same problem for me, any new solution?

evalsxonted avatar Aug 08 '19 17:08 evalsxonted

stopping Onedrive autosync solved the problem for me , i dont know why, how, or what's going on

evalsxonted avatar Aug 09 '19 07:08 evalsxonted

I am still having this problem with 1.17.4

vanlooverenkoen avatar Jun 26 '20 11:06 vanlooverenkoen

I had this issue, but removing the root project .iml fixed it.

hacker1024 avatar Sep 05 '20 10:09 hacker1024

Delete .dart_tool folder from your project root directory.

elias8 avatar Oct 19 '20 10:10 elias8

Same issue here when updating to Flutter 2

efraespada avatar Mar 04 '21 16:03 efraespada

I noticed my problem was a local dependency added to my project:

dependencies:
  random_name:
    path: ../random_name

Using the git integration solved my problem.

dependencies:
  random_name:
    git:
      url: https://github.com/efraespada/random_name.git

But it is crazy how a simple dependency can block/break your project indexation.

efraespada avatar Mar 16 '21 15:03 efraespada

New day, new flutter bug Just bumped into this, seemingly caused by a specific widget tree

duzenko avatar May 05 '21 12:05 duzenko

New day, new flutter bug Just bumped into this, seemingly caused by a specific widget tree

Not a Flutter bug. I'm also looking for a fix of this problem... but i'm using React-Native (Android files in Java). 😏

AurelienDud avatar Sep 08 '21 06:09 AurelienDud

Same issue Channel stable, 3.3.3 (Android) Android Studio (version 4.1)

MikePendo avatar Oct 17 '22 02:10 MikePendo

Same issue Channel stable,3.3.8

chloeeee72 avatar Dec 19 '22 02:12 chloeeee72

flutter pub get

it works for me!!!! thanks

chloeeee72 avatar Dec 19 '22 03:12 chloeeee72

bug the useless 'required' will make bug...

AhhhhDong avatar Jul 21 '23 08:07 AhhhhDong

I have similar bug. For me it is because i use Records. Strangely bug only appear on the line after the Records line.

image

But after I change the record into single type, I able to go to any declaration. image

Hope this info helps.

fuadreza avatar Sep 10 '23 11:09 fuadreza

Same problem. It gets worse with Records.

bernaferrari avatar Nov 08 '23 03:11 bernaferrari

This is enough to trigger the problem:

Make a file named bug.dart:

import 'package:flutter/widgets.dart';

Widget totalBuilder(List<(String, String)> none) {
  return Container();
}

Reproducible project: bug.zip

bernaferrari avatar Nov 08 '23 03:11 bernaferrari