我刚刚更新到Xcode 11.6。我正在使用Dart&Flutter编译我的代码。在iPhone和Android上运行模拟器可以正常工作,但是当我将其引入Xcode并在设备上运行时,出现错误Error: Getter not found: 'nonVirtual'.
我的猜测是,这是最新版本的Flutter或最新版本的Xcode中的错误。
Compiler message:
../../../../apps/flutter-projects/flutter/packages/flutter/lib/src/widgets/focus_traversal.dart:1125:4: Error: Getter not found: 'nonVirtual'.
@nonVirtual
^^^^^^^^^^
../../../../apps/flutter-projects/flutter/packages/flutter/lib/src/widgets/focus_traversal.dart:1125:4: Error: This can't be used as metadata; metadata should be a reference to a compile-time constant variable, or a call to a constant constructor.
@nonVirtual
^
../../../../apps/flutter-projects/flutter/packages/flutter/lib/src/widgets/framework.dart:507:4: Error: Getter not found: 'nonVirtual'.
@nonVirtual
^^^^^^^^^^
../../../../apps/flutter-projects/flutter/packages/flutter/lib/src/widgets/framework.dart:507:4: Error: This can't be used as metadata; metadata should be a reference to a compile-time constant variable, or a call to a constant constructor.
@nonVirtual
^
../../../../apps/flutter-projects/flutter/packages/flutter/lib/src/widgets/framework.dart:511:4: Error: Getter not found: 'nonVirtual'.
@nonVirtual
^^^^^^^^^^
../../../../apps/flutter-projects/flutter/packages/flutter/lib/src/widgets/framework.dart:511:4: Error: This can't be used as metadata; metadata should be a reference to a compile-time constant variable, or a call to a constant constructor.
@nonVirtual
^
../../../../apps/flutter-projects/flutter/packages/flutter/lib/src/painting/image_provider.dart:321:4: Error: Getter not found: 'nonVirtual'.
@nonVirtual
^^^^^^^^^^
../../../../apps/flutter-projects/flutter/packages/flutter/lib/src/painting/image_provider.dart:321:4: Error: This can't be used as metadata; metadata should be a reference to a compile-time constant variable, or a call to a constant constructor.
@nonVirtual
^
Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
build failed.
Command PhaseScriptExecution failed with a nonzero exit code
答案 0 :(得分:0)
就我而言,我只运行了flutter升级,然后开始收到相同的消息。 (我正在使用Android Studio开发)。
我发现最快的解决方法是创建一个新项目,并将我编写的所有代码复制到新项目中(保留所有自动生成的文件)。
这很可能会破坏我的提交历史,但是我需要作一个紧急介绍,这是我能想到的唯一快速解决方案。
答案 1 :(得分:-1)
复制步骤
锻炼已经尝试