_Please tell us what you were doing and what went wrong_
Our project uses packages for each feature of ours. The problem is, opening the root project, the Intellij/AS keeps marking folder packages as excluded.
1- Create new project
2- Create a package inside the packages folder (can do it with flutter create command)
3- Flutter pub get and run the app
3- packages folder will be marked as excluded by the IDE.
❯ flutter doctor -v
[✓] Flutter (Channel stable, v1.10.15-pre.1, on Mac OS X 10.14.6 18G103, locale en-BR)
• Flutter version 1.10.15-pre.1 at /Users/reinaldo.moreira/sdk-flutter
• Framework revision dbbec2785b (2 weeks ago), 2020-01-31 10:31:03 -0300
• Engine revision e73c9c8f6b
• Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/reinaldo.moreira/dev/compilers/android-sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = ~/dev/compilers/android-sdk
• Java binary at: /Applications/Android Studio 3.6.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 10.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.1, Build version 10B61
• CocoaPods version 1.7.5
[✓] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio 3.6.app/Contents
• Flutter plugin version 43.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] Android Studio (version 3.5)
• Android Studio at /Applications/Android Studio 3.5.app/Contents
• Flutter plugin version 42.1.1
• Dart plugin version 191.8593
• Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] Android Studio
• Android Studio at /Applications/Android Studio 4.0 Preview.app/Contents
• Flutter plugin version 42.1.4
• Dart plugin version 193.5731
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] IntelliJ IDEA Community Edition (version 2019.3)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin version 42.1.4
• Dart plugin version 193.5731
[✓] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.0.0 (API 26) (emulator)
• No issues found!
You may want to consider a different folder name than packages/; various Dart tools do interpret directories with that name specially.
You may want to consider a different folder name than
packages/; various Dart tools do interpret directories with that name specially.
I understand, but, despite not being my decision to change the folder name, if I could change packages to any other name, the autocomplete stops working.
This is not something done by the Flutter plugin. The same exclusion happens if you use Dart projects instead of Flutter projects. I don't know if this is caused by the Dart plugin or is a limitation of IntelliJ, but you might check with JetBrains for a solution.
Yes, it's the Dart plugin that excludes packages folder in the root of any Dart/Flutter project automatically. Unfortunately it's not possible to switch off this behavior.
Indeed, packages folder in the root of the dart project has a special meaning and handled specially by different Dart-related tools. It may contain lots of files and symlinks, and we don't want the IDE to spend time indexing them - that's the reason of auto-excluding the folder.
if I could change packages to any other name, the autocomplete stops working.
Not sure I understand this.
Thanks for the info, Alex! I realized too late that I should have cc'd you. I'll add @pq and @bwilkerson since they are interested in completion issues.
Thanks guys for the answer!
if I could change packages to any other name, the autocomplete stops working.
Not sure I understand this.
I've changed packages to features and the IDE autocompletion didn't work anymore, even the syntax highlight was little off.
I've changed packages to features and the IDE autocompletion didn't work anymore, even the syntax highlight was little off.
Make sure features folder is not excluded. IDE won't exclude it automatically.
What's there in this packages (or features) folder? Is there only the content generated by pub get? Fresh versions of pub don't generate packages folder. What's your Dart SDK version?
Our app uses packages to modularize our flutter project. Each small feature is a package folder inside packages, that's why we want the IDE to not exclude it, because we're using this folder to develop the app.
I've changed packages to features and the IDE autocompletion didn't work anymore, even the syntax highlight was little off.
Make sure
featuresfolder is not excluded. IDE won't exclude it automatically.
Yep. I've marked it as source root in my test.
this has been a true pain. I'd love to see this fixed.
FYI I'm following the bloc Login Tutorial which uses a "packages" folder in the root of the flutter project dir. Every time I use the Android Studio "pub get" or "get dependencies" features, the "packages" folder is marked as excluded and hidden from the project. Maybe something for @felangel to have on his radar.
I think it’s worth mentioning I haven’t had any issues having a root level packages directory with VSCode. It will even automatically detect all the sub-packages and run pub get or flutter packages get respectively.
Finally, this has been fixed.
The latest Dart plugin won't change packages folder exclusion state automatically. Users may exclude or unexclude packages folders manually as needed.
Thanks @alexander-doroshko !
Thank you
Most helpful comment
this has been a true pain. I'd love to see this fixed.