Flutter-错误:此库已禁用Null安全功能

时间:2020-11-04 18:25:58

标签: android ios flutter dart

我从事Flutter项目已经很长时间了。现在,我已经安装了新笔记本电脑,并在重新安装了VS Code(Flutter,Android Studio)的工具后,遇到了该问题标题中提到的错误。

Error: Null safety features are disabled for this library.
Try removing the package language version or setting the language version to 2.10 or higher.

根据建议,我已将我的flutter-sdk版本设置为> = 2.10.0,但仍无法正常工作。 要启用NNBD,我必须启用实验性支持,但是人们建议不要使用它,直到完全发布为止。那么,如何使我的代码库正常工作?启用NNBD实验支持,还是有其他解决方案? 这是我扑扑的医生:

[√] Flutter (Channel stable, 1.22.3, on Microsoft Windows [Version 10.0.19041.572], locale en-AT)
    • Flutter version 1.22.3 at C:\flutter
    • Framework revision 8874f21e79 (6 days ago), 2020-10-29 14:14:35 -0700
    • Engine revision a1440ca392
    • Dart version 2.10.3

 
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at C:\Users\xyz\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[!] Android Studio (version 4.1.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.50.1)
    • VS Code at C:\Users\xyz\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.16.0

[√] Connected device (1 available)
    • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 8.0.0 (API 26) (emulator)

! Doctor found issues in 2 categories.

如果需要,我将提供其他信息/日志/文件。

1 个答案:

答案 0 :(得分:4)

我决定再次运行 flutter cleanflutter pub get