如何解决更新TestFairy插件版本后的错误



当我尝试构建iOS版本时,我收到了很多错误。我目前的TestFairy版本是2.0.0。Flutter版本1.22.2。飞镖版本2.10.2。

Xcode's output:
↳
../../../../../.pub-cache/hosted/pub.dartlang.org/testfairy-2.0.0/lib/testfairy.dart:201:23: Error: This requires the null safety language feature, which is experimental.
You can enable the experiment using the '--enable-experiment=non-nullable' command line option.
static Future<String?> getSessionUrl() async {
^
../../../../../.pub-cache/hosted/pub.dartlang.org/testfairy-2.0.0/lib/testfairy.dart:416:13: Error: This requires the null safety language feature, which is experimental.
You can enable the experiment using the '--enable-experiment=non-nullable' command line option.
String? errorMessage) async {
^
../../../../../.pub-cache/hosted/pub.dartlang.org/testfairy-2.0.0/lib/testfairy.dart:442:14: Error: This requires the null safety language feature, which is experimental.
You can enable the experiment using the '--enable-experiment=non-nullable' command line option.
{String? defaultText,

这是维护人员。

2.0.0版本只能在迁移到Dart 2作为开发语言的项目中使用。如果你不想这样做,你可以留在最新的Dart 1版本。

dependencies:
testfairy: ^1.0.25 # Dart 1
# testfairy: 2.0.0 # Dart 2

对于迁移到Dart 2的用户,请确保您的项目根目录有一个与此类似的analysis_options.yaml。重要的部分是top声明中的enabled实验。

您还必须在运行和测试命令中启用相同的实验:

flutter run --enable-experiment=non-nullable --no-sound-null-safety

flutter drive --enable-experiment=non-nullable --no-sound-null-safety -v --target=test_driver/app.dart

确保您遵循了插件的ReadMe文档,然后尝试以下操作。

flutter clean
rm -rf ios/Podfile ios/Podfile.lock pubspec.lock ios/Pods ios/Runner.xcworkspace
flutter packages pub upgrade

最新更新