Sdk: Autocompletion does not work for dependency package.

Created on 6 Apr 2020  ·  10Comments  ·  Source: dart-lang/sdk

@abhishekredspace commented on Mar 31, 2020, 12:52 PM UTC:

Steps to Reproduce

I am recently moving to FLutter and started with Codelabs. I am not seeing the autocomplete working in Android Studio for the dependent class. For example. using the CodeLab, I imported the
import 'package:english_words/english_words.dart'; in my class. I do not see the autocomplete working correctly for this package. Only when I type the complete class name, I see the methods in the class.
Example:
Screen Shot 2020-03-31 at 9 47 38 AM
On line number 9, I had to type the whole class name and for demo purpose, I am showing the issue on line number 10 where you can see the autocomplete does not work.

Version info

[✓] Flutter (Channel stable, v1.12.13+hotfix.8, on Mac OS X 10.15.3 19D76, locale en-CA)
    • Flutter version 1.12.13+hotfix.8 at /Users/asharma/Library/flutter
    • Framework revision 0b8abb4724 (7 weeks ago), 2020-02-11 11:44:36 -0800
    • Engine revision e1e6ced81d
    • Dart version 2.7.0

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/asharma/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • ANDROID_HOME = /Users/asharma/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[✗] Xcode - develop for iOS and macOS
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS development.
      Download at: https://developer.apple.com/xcode/download/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
        sudo xcodebuild -runFirstLaunch
    ✗ CocoaPods not installed.
        CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/platform-plugins
      To install:
        sudo gem install cocoapods

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 44.0.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[!] IntelliJ IDEA Community Edition (version 2019.3.4)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[!] VS Code (version 1.30.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    ✗ Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (1 available)
    • Android SDK built for x86 • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)

! Doctor found issues in 4 categories.

This issue was moved by stevemessick from flutter/flutter-intellij#4451.

analyzer-completion area-analyzer

Most helpful comment

Just make sure that your dependencies are not udner dev_dependencies

All 10 comments

@jacob314 commented on Apr 2, 2020, 3:18 PM UTC:

Have you tried these two steps?

  1. Make sure you run flutter pub get
    https://flutter.dev/docs/get-started/codelab#step-2-use-an-external-package

  2. If that doesn't work, try restarting the analysis server.
    https://www.jetbrains.com/help/idea/dart-analysis-tool-window.html
      | Restart Dart Analysis Server | Click this button to kill the Dart Analysis server and then start it.

If step 1 fixes the issue then there isn't a bug. You will need to run flutter pub get after adding new dependencies.
If step 2 fixes the issue then there is a bug in the analysis server and we can move the bug to
https://github.com/dart-lang/sdk/issues

@abhishekredspace commented on Apr 2, 2020, 3:49 PM UTC:

Thanks for your reply.

Step 1 did not help. I still see the issue.
Step 2, I do not see Restart Dart Analysis Server button.
Screen Shot 2020-04-02 at 12 48 19 PM

@stevemessick commented on Apr 6, 2020, 3:33 PM UTC:

It is the top icon in your screen shot. The red curved arrows. Let us know if that helps.

@abhishekredspace commented on Apr 6, 2020, 3:47 PM UTC:

@stevemessick The documentation over here
https://www.jetbrains.com/help/idea/dart-analysis-tool-window.html shows a different icon for
Restart Dart Analysis Server

Screen Shot 2020-04-06 at 12 44 08 PM

The one you are referring to is mentioned as "Reanalyze Dart Sources". I have tried clicking this one, but no help.

@stevemessick commented on Apr 6, 2020, 4:47 PM UTC:

Looks like the documentation is out of date.

I'm going to try moving this issue. If that doesn't work please file it at the link @jacob314 mentioned above.

/move https://github.com/dart-lang/sdk/issues

move[bot] commented on Apr 6, 2020, 4:47 PM UTC:

⚠️ The command arguments are not valid.

Usage:

/move [to ][<owner>/]<repo>

@stevemessick commented on Apr 6, 2020, 4:48 PM UTC:

One more try.

/move dart-lang/sdk

@jwren Looks like a completeness issue.

Just make sure that your dependencies are not udner dev_dependencies

Just make sure that your dependencies are not udner dev_dependencies

I had this same issue and sure enough I had the dependency under 'dev_dependencies.' Moved it to 'dependencies,' ran flutter pub get again, and autocomplete works as expected. Thank you.

Was this page helpful?
0 / 5 - 0 ratings