Flutter/Dart autocomplete works in VS Code, but no

2020-07-09 06:33发布

问题:

I thought AS was the one primary supported environment when it comes to develop, so this is really unusual.

Alt + Enter in Android Studio

  • Flutter Plugin: v35.2.1

  • Dart Plugin: v183.6270

The very same project opened in VS Code, after reading this.

Ctrl + . in VS Code

  • Flutter Plugin: v.2.26.1

  • Dart Plugin: v2.26.1

Flutter:

flutter --version

Flutter 1.2.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8661d8aecd (3 months ago) • 2019-02-14 19:19:53 -0800
Engine • revision 3757390fa4
Tools • Dart 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

WHY IS THAT?

回答1:

This question was answered on Github.

Android Studio has an older version of the Dart plugin (183.6270) than IntelliJ (191.7019). That newer Dart plugin supports the feature of the analysis server that shows completions for symbols that are not in scope. If you select one of these symbols, your imports will be updated for you automatically.

As Android Studio revs, and moves to a version of the IntelliJ platforms that supports the new Dart plugin, Android Studio will get this feature as well.

Tldr: IntelliJ and VS Code have more up-to-date versions than Android Studio.



回答2:

Auto-complete is now available in Android studio also. If it is doesn't work for you, go to File->Power Save Mode and disable it.

Source: https://github.com/flutter/flutter-intellij/issues/3456#issuecomment-593689793_