构建 apk 命令时出现 Flutter APK 错误 运行?

Flutter APK Errors while build apk command running?

我有一个 flutter 应用程序,它在调试模式下工作正常,但是当我 运行 flutter build apk 命令用于 android apk 时,它显示以下错误。 错误是 cannot 运行 with sound null safety。 错误:

 C:\Users\RAILO\flutter\bin\flutter.bat --no-color build apk

 Building with sound null safety 

Running Gradle task 'assembleRelease'...                        
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:

 - package:flutter_swiper
 - package:flutter_page_indicator
 - package:transformer_page_view

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


FAILURE: Build failed with an exception.

在 main.dart

之上添加这一行

// @dart=2.9

然后运行 $flutter clean && flutter pub get

你也可以试试这个命令。

flutter build apk --release --no-sound-null-safety