首页 > 解决方案 > 如何解决此错误: Struct 'Utf8' 为空。不推荐使用对空结构的支持...改用不透明

问题描述

我最近在运行我的应用程序时开始收到此错误。它似乎并没有影响一切,但是在日志中它非常嘈杂和烦人。我没有更改任何内容或在我的应用程序中添加任何会导致此类问题的内容,我最近唯一做的就是升级到最新版本的 Flutter(我经常升级,所以距离我上次更新只有几天) .

../../../../../flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/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 {
      ^
../../../../../flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/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 {
      ^
../../../../../flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/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 {}
      ^
../../../../../flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/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 {}
      ^
../../../../../flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/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 {}
      ^
../../../../../flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/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 {}
      ^
../../../../../flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/src/structs.dart:2985:7: Info: Struct 'CLSID' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class CLSID extends Struct {}
      ^
../../../../../flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/src/structs.dart:2992:7: Info: Struct 'STATSTG' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class STATSTG extends Struct {}
      ^
../../../../../flutter/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4/lib/src/structs.dart:2999:7: Info: Struct 'NLM_SIMULATED_PROFILE_INFO' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class NLM_SIMULATED_PROFILE_INFO extends Struct {}
      ^
../../../../../flutter/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/utf8.dart:23:7: Info: Struct 'Utf8' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class Utf8 extends Struct {
      ^
../../../../../flutter/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/utf16.dart:16:7: Info: Struct 'Utf16' is empty. Support for empty structs is deprecated and will be removed in the next stable version of Dart. Use Opaque instead.
class Utf16 extends Struct {
      ^

列表中的最后一个错误看起来略有不同:

../../../../../flutter/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/allocation.dart:47:33: Info: Support for using non-constant type arguments 'T' in this FFI API is deprecated and will be removed in the next stable version of Dart. Rewrite the code to ensure that type arguments are compile time constants referring to a valid native type.
  final int totalSize = count * sizeOf<T>();
                                ^

知道如何解决这个问题吗?我试过flutter clean了,但这并没有解决它。

这是我的flutter doctor输出:

Flutter 1.26.0-13.0.pre.190 • channel master • https://github.com/flutter/flutter.git
Framework • revision 7db172b24d (50 minutes ago) • 2021-01-26 17:18:40 -0800
Engine • revision b11bef83a5
Tools • Dart 2.12.0 (build 2.12.0-263.0.dev)

Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.26.0-13.0.pre.190, on Mac OS X 10.15.7 19H2 darwin-x64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] IntelliJ IDEA Community Edition (version 2020.3.1)
[✓] VS Code (version 1.52.1)
[✓] Connected device (2 available)

• No issues found!

标签: flutterdart

解决方案


显然这个flutter SDK版本有错误,之前的版本运行良好,你可以在flutter控制台使用这个命令解决这个问题:

flutter downgrade

推荐阅读