How to autocomplete/import Flutter classes in IntelliJ?

3,377

This is a known issue.

For performance reasons the DartAnalyzer was built to only load libraries that were imported anywhere in the projects code already. The overall performance of DartAnalyzer was improved a lot since then and it would now allow to provide better suggestions, but it seems there weren't enough resources available yet to get it implemented.

Upvote and follow https://github.com/dart-lang/sdk/issues/25820

Share:
3,377
Duncan Jones
Author by

Duncan Jones

Updated on December 07, 2022

Comments

  • Duncan Jones
    Duncan Jones over 1 year

    In IntelliJ, I have to manually import Flutter packages at the top of the file in order for auto-complete to work elsewhere in the file.

    I was rather hoping I could start typing something (in a method) and IntelliJ would search my pubspec.yaml and locally within my project and suggest classes I might want. If I selected something that wasn't already imported, it should import it for me.

    This basic functionality is available in many other languages and IDEs, so I'm wondering if I've got something misconfigured. I'm using IntelliJ 2018.2 with the latest Flutter and Dart plugins installed.

  • CopsOnRoad
    CopsOnRoad over 5 years
    DartAnalyzer is way too slow. I have to wait even after completely writing MaterialApp word, it takes too long to show the list.
  • Günter Zöchbauer
    Günter Zöchbauer over 5 years
    DartAnalyzer was worked on a lot the last 2 (or so) years and lots of optimizations were done that made it faster and lots of additional features that made it slower. Currently they are working or replacing big parts by the common frontend developed for Dart 2 (mentioned in medium.com/dartlang/…). I guess after that work is complete there will be again more performance optimizations.
  • CopsOnRoad
    CopsOnRoad over 5 years
    Hoping for these tiny fixes asap.
  • Günter Zöchbauer
    Günter Zöchbauer over 5 years
    I don't think there is anything tiny about that :D
  • CopsOnRoad
    CopsOnRoad over 5 years
    Tiny in the sense, they are not the core components but still very useful in order to have smooth IDE experience.
  • Günter Zöchbauer
    Günter Zöchbauer over 5 years
    I see. I got the impression they consider adding everything that makes developer experience better, but the changes from Dart 1 to Dart 2 were so fundamental that there are still some bigger chunks on lower levels with higher priority to fix before they can work on higher levels that depend on lower levels for these "tiny" convenient features.