Flutter 应用程序在调试构建时完美无缺,但在发布时无法构建

问题描述

我需要你的帮助。 我最近开始使用颤振,直到现在,一切都很好,没有任何问题。但是突然间,当我尝试为 --release 构建 appbundle 或 apk 时,出现了一些奇怪的错误

../../third_party/dart/runtime/vm/compiler/aot/precompiler.cc: 2761: error: unreachable code
../../third_party/dart/runtime/vm/compiler/aot/precompiler.cc: 2761: error: unreachable code
../../third_party/dart/runtime/vm/compiler/aot/precompiler.cc: 2761: error: unreachable code
Dart snapshot generator Failed with exit code -1073740791
Dart snapshot generator Failed with exit code -1073740791
Dart snapshot generator Failed with exit code -1073740791


FAILURE: Build Failed with an exception.

* Where:
Script 'C:\src\Flutter\packages\Flutter_tools\gradle\Flutter.gradle' line: 991

* What went wrong:
Execution Failed for task ':app:compileFlutterbuildrelease'.
> Process 'command 'C:\src\Flutter\bin\Flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD Failed in 24s
Running Gradle task 'bundleRelease'...
Running Gradle task 'bundleRelease'... Done                        25,6s
Gradle task bundleRelease Failed with exit code 1

当我使用稳定频道时会发生这种情况。切换到主频道时会发生这种情况:

/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-0.0.4+3/lib/src/path_provider_windows_real.dart:126:25: Error: The getter 'addressOf' isn't defined for the class 'GUID'.
 - 'GUID' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
          kNownFolderID.addressOf,KF_FLAG_DEFAULT,NULL,pathPtrPtr);
                        ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/tflite_Flutter-0.5.0/lib/src/delegates/gpu_delegate.dart:58:10: Error: The getter 'addressOf' isn't defined for the class 'TfLiteGpuDelegateOptionsV2'.
 - 'TfLiteGpuDelegateOptionsV2' is from 'package:tflite_Flutter/src/bindings/types.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/tflite_Flutter-0.5.0/lib/src/bindings/types.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
        .addressOf);
         ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/tflite_Flutter-0.5.0/lib/src/delegates/Metal_delegate.dart:42:70: Error: The getter 'addressOf' isn't defined for the class 'TFLGpuDelegateOptions'.
 - 'TFLGpuDelegateOptions' is from 'package:tflite_Flutter/src/bindings/types.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/tflite_Flutter-0.5.0/lib/src/bindings/types.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
        TFLGpuDelegateOptions.allocate(allowPrecisionLoss,waitType).addressOf);
                                                                     ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:1067:7: Error: The getter 'addressOf' isn't defined for the class 'LOGFONT'.
 - 'LOGFONT' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
      addressOf.cast<Uint8>().elementAt(28).cast<Utf16>();
      ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:1112:29: Error: The getter 'addressOf' isn't defined for the class 'ENUMLOGFONTEX'.
 - 'ENUMLOGFONTEX' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
  LOGFONT get elfLogFont => addressOf.cast<LOGFONT>().ref;
                            ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:1114:29: Error: The getter 'addressOf' isn't defined for the class 'ENUMLOGFONTEX'.
 - 'ENUMLOGFONTEX' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
  String get elfFullName => addressOf
                            ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:1120:26: Error: The getter 'addressOf' isn't defined for the class 'ENUMLOGFONTEX'.
 - 'ENUMLOGFONTEX' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
  String get elfStyle => addressOf
                         ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:1126:27: Error: The getter 'addressOf' isn't defined for the class 'ENUMLOGFONTEX'.
 - 'ENUMLOGFONTEX' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
  String get elfScript => addressOf
                          ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2688:7: Error: The getter 'addressOf' isn't defined for the class 'OsveRSIONINFO'.
 - 'OsveRSIONINFO' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
      addressOf.cast<Uint8>().elementAt(20).cast<Utf16>().unpackString(128);
      ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2699:11: Error: The getter 'addressOf' isn't defined for the class 'OsveRSIONINFO'.
 - 'OsveRSIONINFO' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
        ..addressOf.cast<Uint8>().elementAt(20).value = 0;
          ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2744:24: Error: The getter 'addressOf' isn't defined for the class 'BLUetoOTH_DEVICE_INFO'.
 - 'BLUetoOTH_DEVICE_INFO' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
  String get szName => addressOf
                       ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2837:7: Error: The getter 'addressOf' isn't defined for the class 'BLUetoOTH_PIN_INFO'.
 - 'BLUetoOTH_PIN_INFO' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
      addressOf.cast<Uint8>().elementAt(BTH_MAX_PIN_SIZE).value;
      ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2840:5: Error: The getter 'addressOf' isn't defined for the class 'BLUetoOTH_PIN_INFO'.
 - 'BLUetoOTH_PIN_INFO' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
    addressOf.cast<Uint8>().elementAt(BTH_MAX_PIN_SIZE).value =
    ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2845:28: Error: The getter 'addressOf' isn't defined for the class 'BLUetoOTH_PIN_INFO'.
 - 'BLUetoOTH_PIN_INFO' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
      String.fromCharCodes(addressOf.cast<Uint8>().asTypedList(pinLength));
                           ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2853:7: Error: The getter 'addressOf' isn't defined for the class 'BLUetoOTH_PIN_INFO'.
 - 'BLUetoOTH_PIN_INFO' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
      addressOf.cast<Uint8>().elementAt(idx).value = pinData[idx];
      ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/com/combase.dart:38:31: Error: The getter 'addressOf' isn't defined for the class 'GUID'.
 - 'GUID' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
  final iid = GUID.allocate().addressOf;
                              ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/com/combase.dart:56:33: Error: The getter 'addressOf' isn't defined for the class 'GUID'.
 - 'GUID' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
  final clsid = GUID.allocate().addressOf;
                                ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/winrt/winrt_helpers.dart:86:40: Error: The getter 'addressOf' isn't defined for the class 'GUID'.
 - 'GUID' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
  final riidCalendar = GUID.allocate().addressOf;
                                       ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/generated/IDesktopWallpaper.dart:197:38: Error: The getter 'addressOf' isn't defined for the class 'COMObject'.
 - 'COMObject' is from 'package:win32/src/com/combase.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/com/combase.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
    final ptr = COMObject.allocate().addressOf;
                                     ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/generated/IDesktopWallpaper.dart:200:49: Error: The getter 'addressOf' isn't defined for the class 'GUID'.
 - 'GUID' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
        GUID.fromString(CLSID_DesktopWallpaper).addressOf,^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/generated/IDesktopWallpaper.dart:203:48: Error: The getter 'addressOf' isn't defined for the class 'GUID'.
 - 'GUID' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
        GUID.fromString(IID_IDesktopWallpaper).addressOf,^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/generated/IFileOpenDialog.dart:58:38: Error: The getter 'addressOf' isn't defined for the class 'COMObject'.
 - 'COMObject' is from 'package:win32/src/com/combase.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/com/combase.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
    final ptr = COMObject.allocate().addressOf;
                                     ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/generated/IFileOpenDialog.dart:61:47: Error: The getter 'addressOf' isn't defined for the class 'GUID'.
 - 'GUID' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
        GUID.fromString(CLSID_FileOpenDialog).addressOf,^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/generated/IFileOpenDialog.dart:64:46: Error: The getter 'addressOf' isn't defined for the class 'GUID'.
 - 'GUID' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
        GUID.fromString(IID_IFileOpenDialog).addressOf,^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/generated/IFileSaveDialog.dart:99:38: Error: The getter 'addressOf' isn't defined for the class 'COMObject'.
 - 'COMObject' is from 'package:win32/src/com/combase.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/com/combase.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
    final ptr = COMObject.allocate().addressOf;
                                     ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/generated/IFileSaveDialog.dart:102:47: Error: The getter 'addressOf' isn't defined for the class 'GUID'.
 - 'GUID' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
        GUID.fromString(CLSID_FileSaveDialog).addressOf,^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/generated/IFileSaveDialog.dart:105:46: Error: The getter 'addressOf' isn't defined for the class 'GUID'.
 - 'GUID' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
        GUID.fromString(IID_IFileSaveDialog).addressOf,^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/generated/IKNownFolderManager.dart:164:38: Error: The getter 'addressOf' isn't defined for the class 'COMObject'.
 - 'COMObject' is from 'package:win32/src/com/combase.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/com/combase.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
    final ptr = COMObject.allocate().addressOf;
                                     ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/generated/IKNownFolderManager.dart:167:51: Error: The getter 'addressOf' isn't defined for the class 'GUID'.
 - 'GUID' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
        GUID.fromString(CLSID_KNownFolderManager).addressOf,^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/generated/IKNownFolderManager.dart:170:50: Error: The getter 'addressOf' isn't defined for the class 'GUID'.
 - 'GUID' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
        GUID.fromString(IID_IKNownFolderManager).addressOf,^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/generated/INetworkListManager.dart:128:38: Error: The getter 'addressOf' isn't defined for the class 'COMObject'.
 - 'COMObject' is from 'package:win32/src/com/combase.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/com/combase.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
    final ptr = COMObject.allocate().addressOf;
                                     ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/generated/INetworkListManager.dart:131:51: Error: The getter 'addressOf' isn't defined for the class 'GUID'.
 - 'GUID' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
        GUID.fromString(CLSID_NetworkListManager).addressOf,^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/generated/INetworkListManager.dart:134:50: Error: The getter 'addressOf' isn't defined for the class 'GUID'.
 - 'GUID' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
        GUID.fromString(IID_INetworkListManager).addressOf,^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/generated/IWbemLocator.dart:82:38: Error: The getter 'addressOf' isn't defined for the class 'COMObject'.
 - 'COMObject' is from 'package:win32/src/com/combase.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/com/combase.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
    final ptr = COMObject.allocate().addressOf;
                                     ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/generated/IWbemLocator.dart:84:68: Error: The getter 'addressOf' isn't defined for the class 'GUID'.
 - 'GUID' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
    final hr = CoCreateInstance(GUID.fromString(CLSID_WbemLocator).addressOf,^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/generated/IWbemLocator.dart:85:64: Error: The getter 'addressOf' isn't defined for the class 'GUID'.
 - 'GUID' is from 'package:win32/src/structs.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
        nullptr,CLSCTX_ALL,GUID.fromString(IID_IWbemLocator).addressOf,ptr);
                                                               ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/utf8.dart:63:33: Error: The getter 'addressOf' isn't defined for the class 'Utf8'.
 - 'Utf8' is from 'package:ffi/src/utf8.dart' ('/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/utf8.dart').
Try correcting the name to the name of an existing getter,or defining a getter or field named 'addressOf'.
  String toString() => fromUtf8(addressOf);
                                ^^^^^^^^^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/tflite_Flutter-0.5.0/lib/src/bindings/types.dart:6:7: Error: Struct 'TfLiteInterpreter' is empty. Empty structs are undefined behavior.
class TfLiteInterpreter extends Struct {}
      ^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/tflite_Flutter-0.5.0/lib/src/bindings/types.dart:9:7: Error: Struct 'TfLiteInterpreterOptions' is empty. Empty structs are undefined behavior.
class TfLiteInterpreterOptions extends Struct {}
      ^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/tflite_Flutter-0.5.0/lib/src/bindings/types.dart:12:7: Error: Struct 'TfLiteModel' is empty. Empty structs are undefined behavior.
class TfLiteModel extends Struct {}
      ^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/tflite_Flutter-0.5.0/lib/src/bindings/types.dart:15:7: Error: Struct 'TfLiteTensor' is empty. Empty structs are undefined behavior.
class TfLiteTensor extends Struct {}
      ^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/tflite_Flutter-0.5.0/lib/src/bindings/types.dart:18:7: Error: Struct 'TfLiteDelegate' is empty. Empty structs are undefined behavior.
class TfLiteDelegate extends Struct {}
      ^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:1111:7: Error: Struct 'ENUMLOGFONTEX' is empty. Empty structs are undefined behavior.
class ENUMLOGFONTEX extends Struct {
      ^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2835:7: Error: Struct 'BLUetoOTH_PIN_INFO' is empty. Empty structs are undefined behavior.
class BLUetoOTH_PIN_INFO extends Struct {
      ^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2960:7: Error: Struct 'EXCEPINFO' is empty. Empty structs are undefined behavior.
class EXCEPINFO extends Struct {}
      ^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2966:7: Error: Struct 'PROPERTYKEY' is empty. Empty structs are undefined behavior.
class PROPERTYKEY extends Struct {}
      ^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2973:7: Error: Struct 'PROPVARIANT' is empty. Empty structs are undefined behavior.
class PROPVARIANT extends Struct {}
      ^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2978:7: Error: Struct 'SAFEARRAY' is empty. Empty structs are undefined behavior.
class SAFEARRAY extends Struct {}
      ^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2985:7: Error: Struct 'CLSID' is empty. Empty structs are undefined behavior.
class CLSID extends Struct {}
      ^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2992:7: Error: Struct 'STATSTG' is empty. Empty structs are undefined behavior.
class STATSTG extends Struct {}
      ^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:2999:7: Error: Struct 'NLM_SIMULATED_PROFILE_INFO' is empty. Empty structs are undefined behavior.
class NLM_SIMULATED_PROFILE_INFO extends Struct {}
      ^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/utf8.dart:23:7: Error: Struct 'Utf8' is empty. Empty structs are undefined behavior.
class Utf8 extends Struct {
      ^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/utf16.dart:16:7: Error: Struct 'Utf16' is empty. Empty structs are undefined behavior.
class Utf16 extends Struct {
      ^
/C:/src/Flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/allocation.dart:47:33: Error: Expected type 'T' to be a valid and instantiated subtype of 'NativeType'.
  final int totalSize = count * sizeOf<T>();
                                ^


FAILURE: Build Failed with an exception.

* Where:
Script 'C:\src\Flutter\packages\Flutter_tools\gradle\Flutter.gradle' line: 1035

* What went wrong:
Execution Failed for task ':app:compileFlutterbuildrelease'.
> Process 'command 'C:\src\Flutter\bin\Flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD Failed in 16s
Running Gradle task 'bundleRelease'...
Running Gradle task 'bundleRelease'... Done                        17,1s
Gradle task bundleRelease Failed with exit code 1

这是我的颤振医生:

Doctor summary (to see all details,run Flutter doctor -v):
[√] Flutter (Channel master,2.2.0-11.0.pre.165,on Microsoft Windows [Version 10.0.19042.928],locale de-DE)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[√] Android Studio (version 4.1.0)
[√] IntelliJ IDEA Ultimate Edition (version 2020.2)
[√] IntelliJ IDEA Ultimate Edition (version 2021.1)
[√] VS Code (version 1.52.1)
[√] Connected device (3 available)

• No issues found!

这些是我的依赖项:


dependencies:
  Flutter:
    sdk: Flutter
  path:
  camera:
  image_picker:
  path_provider:
  tflite_Flutter:
  tflite_Flutter_helper:
  material_design_icons_Flutter:
  hive:
  hive_Flutter:
  Meta:
  collection:

我希望你能以某种方式帮助我...


编辑(21.04.2021):

更新每个依赖项以使用声音空安全后,稳定版本的输出不会改变,但在主频道上会出现:

Building with sound null safety 

../../third_party/dart/runtime/vm/compiler/aot/precompiler.cc: 3297: error: unreachable code
../../third_party/dart/runtime/vm/compiler/aot/precompiler.cc: 3297: error: unreachable code
../../third_party/dart/runtime/vm/compiler/aot/precompiler.cc: 3297: error: unreachable code
Dart snapshot generator Failed with exit code -1073740791
Dart snapshot generator Failed with exit code -1073740791
Dart snapshot generator Failed with exit code -1073740791


FAILURE: Build Failed with an exception.

* Where:
Script 'C:\src\Flutter\packages\Flutter_tools\gradle\Flutter.gradle' line: 1035

* What went wrong:
Execution Failed for task ':app:compileFlutterbuildrelease'.
> Process 'command 'C:\src\Flutter\bin\Flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD Failed in 8s
Running Gradle task 'bundleRelease'...
Running Gradle task 'bundleRelease'... Done                         9,4s
Gradle task bundleRelease Failed with exit code 1


所以与稳定分支的结果基本相同,但其他行无法访问。 (2761 -> 3297)

解决方法

我发现了问题:

if (box.isNotEmpty && box.getAt(0) != null) {
  Drinks first = box.getAt(0);
  DateTime now = DateTime.now();
  DateTime firstDate = DateTime.fromMillisecondsSinceEpoch(first.date!);
  Duration difference = firstDate.difference(now);
  int weekDay = difference.inDays;
  int weeksSinceStart = (weekDay / 7) as int;
  print("WeeksSinceStart: $weeksSinceStart");
  return weeksSinceStart;
} else {
  print("Box is empty - > Week  = 0");
  return 0;
}

所以问题可能出在持续时间或蜂巢箱中...