【发布时间】:2021-05-06 20:19:10
【问题描述】:
我大约 2 个月前构建了一个 Flutter 应用,效果很好,并在 App Store 和 Play Store 上获得了批准。
这几天我正在尝试向应用程序添加新功能,但由于某种原因,Flutter 无法在 iOS 模拟器和 Android 模拟器上运行该应用程序。
我收到以下错误消息:
安卓:
Launching lib/main.dart on sdk gphone x86 arm in debug mode...
lib/main.dart:1
../../../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/extended_image-1.5.0/lib/src/extended_image.dart:785:44: Error: No named parameter with the name 'nullOk'.
_invertColors = MediaQuery.of(context, nullOk: true)?.invertColors ??
^^^^^^
../../../../../../Developer/flutter/packages/flutter/lib/src/widgets/media_query.dart:818:25: Context: Found this candidate, but the arguments don't match.
static MediaQueryData of(BuildContext context) {
^^
../../../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:1111:7: Info: Struct 'ENUMLOGFONTEX' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class ENUMLOGFONTEX extends Struct {
^
../../../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2835:7: Info: Struct 'BLUETOOTH_PIN_INFO' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class BLUETOOTH_PIN_INFO extends Struct {
^
../../../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2960:7: Info: Struct 'EXCEPINFO' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class EXCEPINFO extends Struct {}
^
../../../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2966:7: Info: Struct 'PROPERTYKEY' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class PROPERTYKEY extends Struct {}
^
../../../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2973:7: Info: Struct 'PROPVARIANT' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class PROPVARIANT extends Struct {}
^
../../../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2978:7: Info: Struct 'SAFEARRAY' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class SAFEARRAY extends Struct {}
iOS:
Launching lib/main.dart on iPhone 11 in debug mode...
lib/main.dart:1
Xcode build done. 24.8s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
gRPC-Core-camshfbxfmecuqamkwvicvcxlaiu
../../../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/extended_image-1.5.0/lib/src/extended_image.dart:785:44: Error: No named parameter with the name 'nullOk'.
_invertColors = MediaQuery.of(context, nullOk: true)?.invertColors ??
^^^^^^
../../../../../../Developer/flutter/packages/flutter/lib/src/widgets/media_query.dart:818:25: Context: Found this candidate, but the arguments don't match.
static MediaQueryData of(BuildContext context) {
^^
../../../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:1111:7: Info: Struct 'ENUMLOGFONTEX' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class ENUMLOGFONTEX extends Struct {
^
../../../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2835:7: Info: Struct 'BLUETOOTH_PIN_INFO' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class BLUETOOTH_PIN_INFO extends Struct {
^
../../../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2960:7: Info: Struct 'EXCEPINFO' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class EXCEPINFO extends Struct {}
^
../../../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2966:7: Info: Struct 'PROPERTYKEY' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class PROPERTYKEY extends Struct {}
^
../../../../../../Developer/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2973:7: Info: Struct 'PROPVARIANT' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
我已尝试更新 pubsapec.yaml 文件中的所有依赖项,但也没有用。
有谁知道为什么 Flutter 无法构建应用程序?我真的不明白为什么。
非常感谢!
【问题讨论】:
-
似乎您正在使用的插件已更改如果您有关于上次成功构建应用程序时使用的插件版本的信息 - 您只能为插件设置一个版本(不带
^)并尝试再次构建应用程序。如果您没有关于插件版本的信息,您可以手动逐步迁移应用程序。 -
我在更新我的 flutter-dev 版本后遇到了这个问题,但它可以编译并运行。
标签: flutter dart flutter-dependencies flutter-test