Flutter 开发 Cannot run with sound null safety解决方案

初次开发Flutter,初次使用Flutter第三方库(english_words)如下:

dependencies:
  flutter:
    sdk: flutter
   cupertino_icons: ^1.0.2
   english_words: ^3.1.5

结果:一跑报下面错

Launching lib\main.dart on Redmi K30 5G in debug mode...
Running Gradle task 'assembleDebug'...
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:

 - package:english_words

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


FAILURE: Build failed with an exception.

* Where:
Script 'D:\flutter\sdk\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1070

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\flutter\sdk\flutter\bin\flutter.bat'' finished with non-zero exit value 1

解决方法如下:
第一步:
在AndroidStudio->Run->Edit Configurations


image.png

第二步:在Additional run args 填入命令:--no-sound-null-safety

image.png

再运行就不会再报错了!

你可能感兴趣的:(Flutter 开发 Cannot run with sound null safety解决方案)