0

您好,当我运行包含 firestore/firebase_core 的 Flutter 代码时出现此错误我尝试了多个部署目标,但仍然出现错误

Launching lib/main.dart on macOS in debug mode...
Building macOS application...
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:

 - package:firebase_core
 - package:firebase_core_platform_interface
 - package:quiver
 - package:plugin_platform_interface
 - package:cloud_firestore
 - package:cloud_firestore_platform_interface

For solutions, see https://dart.dev/go/unsound-null-safety

Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.7, but the range of supported deployment target versions is 10.9 to 11.0.99. (in target 'BoringSSL-GRPC' from project 'Pods')
warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.6, but the range of supported deployment target versions is 10.9 to 11.0.99. (in target 'nanopb' from project 'Pods')
warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.7, but the range of supported deployment target versions is 10.9 to 11.0.99. (in target 'leveldb-library' from project 'Pods')
** BUILD FAILED **

Exception: Build process failed
4

1 回答 1

1

发生此错误是因为您尝试使用不支持 null 安全性的库来运行您的应用程序。您可以通过使用以下命令运行应用程序来解决此问题:

颤振运行--no-sound-null-safety

如果您使用的是 IDE,则需要更改运行配置,例如在 VSCode 中将是:

Code => Preferences => Settings => 搜索设置,输入“flutter test” => Dart: Flutter Test Additional Args, Add item => Add "--no-sound-null-safety

我建议您检查链接以了解如何更好地理解此错误。

于 2021-05-31T07:59:21.153 回答