0

当我尝试构建 iOS 版本时,我收到了很多错误。我当前的 TestFairy 版本是 2.0.0。颤振版本 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,
4

2 回答 2

0

确保您遵循插件的自述文件,然后尝试以下操作。

flutter clean
rm -rf ios/Podfile ios/Podfile.lock pubspec.lock ios/Pods ios/Runner.xcworkspace
flutter packages pub upgrade
于 2020-10-19T16:49:22.657 回答
0

这是维护者。

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似的. 重要的部分是顶部声明中的已启用实验。

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

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

于 2020-10-20T10:33:56.813 回答