英文:
VSCode Flutter Debug and Execution given a no-sound-null-safety
问题
Until yesterday everything worked just fine. But for publishing reasons I needed to update my flutter SDK and gradle version, and after that my VsCode debug simply stopped working. It keeps giving me the Could not find an option named "no-sound-null-safety".
error.
Flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.5, on Linux Mint 21.1 5.15.0-76-generic, locale pt_BR.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2022.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.3)
[✓] VS Code (version 1.79.2)
[✓] Connected device (2 available)
[✓] Network resources
Here's my vsCode.json configs:
After I reopen the VsCode it also gives me this error:
英文:
Until yesterday everything worked just fine. But for publishing reasons I needed to update my flutter SDK and gradle version, and after that my VsCode debug simply stopped working. It keeps giving me the Could not find an option named "no-sound-null-safety".
error.
Flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.5, on Linux Mint 21.1 5.15.0-76-generic, locale pt_BR.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2022.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.3)
[✓] VS Code (version 1.79.2)
[✓] Connected device (2 available)
[✓] Network resources
Here's my vsCode.json configs:
After I reopen the VsCode it also gives me this error:
答案1
得分: 1
你正在使用 Flutter 3.10,它使用 Dart 3:
> Dart 3—计划于 2023 年中发布—要求具备空安全性。它将阻止在没有空安全性或具有不安全的空安全性时运行代码。所有现有代码必须迁移到具备空安全性才能与 Dart 3 兼容。要了解更多信息,请参阅 Dart 3 空安全性跟踪问题。
所以你实际上有两个选项:
- 迁回 Dart 2,也就是 Flutter 3.7 或更早版本,
- 将你的代码迁移到具备空安全性。
英文:
You are using Flutter 3.10, which uses Dart 3:
> Dart 3—planned for a mid-2023 release—requires sound null safety. It will prevent code from running without null safety, or with unsound null safety. All existing code must be migrated to sound null safety to be compatible with Dart 3. To learn more, see the Dart 3 sound null safety tracking issue.
— Unsound null safety | Dart
So you have two options really:
- migrate back to Dart 2, that is Flutter 3.7 or earlier,
- migrate your code to sound null safety.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论