Flutter Xcode 构建失败,因为 Flutter Form Builder 存在一些依赖问题

Flutter Xcode build failed because some dependencies problem with Flutter Form Builder

我一直在努力解决这个问题:

Error output from Xcode build:
↳
    ** BUILD FAILED **


Xcode's output:
↳
    1 warning generated.
    /Users/ME/development/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_datetime_picker-1.3.8/lib/src/datetime_picker_theme.dart:6:28: Error: Type 'DiagnosticableMixin' not found.
    class DatePickerTheme with DiagnosticableMixin {
                               ^^^^^^^^^^^^^^^^^^^
    /Users/ME/development/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_datetime_picker-1.3.8/lib/src/datetime_picker_theme.dart:6:7: Error: The type 'DiagnosticableMixin' can't be mixed in.
    class DatePickerTheme with DiagnosticableMixin {
          ^
    /Users/ME/development/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_form_builder-4.0.0-alpha.8/lib/src/fields/form_builder_chips_input.dart:95:17: Error: No named parameter with the name 'allowChipEditing'.
                    allowChipEditing: allowChipEditing,
                    ^^^^^^^^^^^^^^^^
    /Users/ME/development/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_chips_input-1.9.0-dev.1/lib/src/chips_input.dart:13:3: Context: Found this candidate, but the arguments don't match.
      ChipsInput({
      ^^^^^^^^^^

    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Building targets in parallel
    note: Planning build
    note: Constructing build description

Could not build the application for the simulator.

我正在使用 flutter_form_builder-4.0.0-alpha.8 这是我的 flutter doctor -v:

[✓] Flutter (Channel dev, 1.21.0-1.0.pre, on Mac OS X 10.15.6 19G73, locale en-US)
    • Flutter version 1.21.0-1.0.pre at /Users/ME/development/flutter
    • Framework revision f25bd9c55c (2 weeks ago), 2020-07-14 20:26:01 -0400
    • Engine revision 99c2b3a245
    • Dart version 2.9.0 (build 2.9.0-21.0.dev 20bf2fcf56)
    • Pub download mirror https://pub.flutter-io.cn
    • Flutter download mirror https://storage.flutter-io.cn

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Applications/Android/sdk
    • Platform android-29, build-tools 29.0.3
    • ANDROID_HOME = /Applications/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.6, Build version 11E708
    • CocoaPods version 1.9.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 48.0.2-dev.4
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.47.3)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.8.0

[✓] Connected device (4 available)
    • iPhone 11 Pro Max (mobile)  • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-13-6 (simulator)
    • Web Server (web)           • web-server                               • web-javascript • Flutter Tools
    • Chrome (web)               • chrome                                   • web-javascript • Google Chrome

• No issues found!

我完成了:

  1. 我能在 flutter 中做的一切:

    • 做了flutter clean,重建,
    • 删除Pods然后做flutter pub getpod setuppod install
    • 有没有flutter upgrade
  2. 删除并重新安装 flutter、cocoapods、ruby 和 dart

  3. 更改 master 和 dev 之间的 flutter 通道并重复第 1 点。none 有效

  4. 也尝试使用 pub.dev 来源和 pub.flutter-io.cn。两者给出相同的结果。

现在 2 天都浪费在这个问题上了。所以我怀疑可能是某些包或代码有问题?

感谢任何帮助!谢谢

最后我解决了这个问题:

  1. 按照建议将 flutter_datetime_picker-1.3.8 中的 DiagnosticableMixin 更改为 Diagnosticable here

说明:显然正在进行的讨论仍在进行中。文件flutter_datetime_picker-1.3.8.dart中有注释如下:

Migrate DiagnosticableMixin to Diagnosticable until https://github.com/flutter/flutter/pull/51495 makes it into stable (v1.15.21)

  1. 评论 form_builder_chips_input.dart 中的第 95-97 行:
allowChipEditing: allowChipEditing,
autofocus: autofocus,
focusNode: focusNode,

由于某些未知原因,这三个参数未在 ChipsInput

中定义

希望这对某人有所帮助,因为我花了一段时间才解决这些问题,因为这些问题来自外部包。