【问题标题】:Intellij Flutter adding prefix to importsIntellij Flutter 为导入添加前缀
【发布时间】:2019-09-29 00:55:37
【问题描述】:

我已经安装了最新版本的 IntelliJ 和最新版本的 Flutter 插件。但是当我为List 触发代码完成(Command + Space)时,我看到它被添加到导入中

import 'dart:core' as prefix0;

我的List变成了

prefix0.List

我能做些什么来避免这个烦人的错误?


颤振医生:

[✓] Flutter (Channel stable, v1.2.1, on Mac OS X 10.14.4 18E226, locale en-US)
    • Flutter version 1.2.1 at /Users/sravindran/dev/flutter
    • Framework revision 8661d8aecd (3 months ago), 2019-02-14 19:19:53 -0800
    • Engine revision 3757390fa4
    • Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/sravindran/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = /Users/sravindran/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_152-release-1248-b01)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.2.1, Build version 10E1001
    • ios-deploy 1.9.4
    • CocoaPods version 1.6.1

[✓] Android Studio (version 3.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 33.3.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[✓] IntelliJ IDEA Community Edition (version 2019.1.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 35.3.3
    • Dart plugin version 191.7141.49

[✓] VS Code (version 1.30.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 2.25.1

[!] Connected device
    ! No devices available

! Doctor found issues in 1 category.
Process finished with exit code 0

【问题讨论】:

  • 我认为您有一些配置错误。无需为List 导入dart:core。你能发布flutter doctor 的输出吗?
  • 我从工具 > Flutter > Flutter Doctor 运行了 Flutter Doctor。这是输出 - pastebin.com/JYs2Yc1D
  • 我在 beta 频道(运行 Flutter v. 1.5.4-hotfix.2)和 IntelliJ 2019.1.1 中遇到了同样的问题

标签: intellij-idea flutter


【解决方案1】:

关于这个有一个封闭的问题。 https://github.com/dart-lang/sdk/issues/36890

我猜这是按顺序执行某些操作时 SDK 中的错误。对我来说,重置计算机,Visual Studio Code 就解决了导入问题。

【讨论】:

    猜你喜欢
    • 2019-01-22
    • 2017-06-09
    • 1970-01-01
    • 2012-04-03
    • 2021-05-14
    • 2013-04-07
    • 1970-01-01
    • 2018-12-12
    相关资源
    最近更新 更多