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.
Auto-import There are several options in IntelliJ IDEA that we may configure in Settings > Editor > Auto Import: Let's review each of these options. 2.1. Show Import Popup
Import packages instead of single classes. IntelliJ IDEA suggests to import single classes by default. You can change the settings to import entire packages instead. In the Settings/Preferences dialog (Ctrl+Alt+S), select . Clear the Use single class import checkbox, and apply the changes.
When looking for a command/keyboard shortcut, type Ctrl-shift-A (or Cmd-shift-A on Mac), and search for the command. For example here, typing "imports" will show you the command "Optimize imports", and its keyboard shortcut. The auto import for classes is working if you enable it under "Settings > Editor > General > Auto Import".
After the new keyword in an object declaration Start typing. By default, IntelliJ IDEA displays the code completion popup automatically as you type. If automatic completion is disabled, press Ctrl+Shift+Space or choose Code | Code Completion | Type-Matching from the main menu.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With