flutter run 报错

/C:/Users/win%2010/AppData/Roaming/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 {
                       ^^^^^^^^^^^^^^^^^^^
/C:/Users/win%2010/AppData/Roaming/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 {
  ^


FAILURE: Build failed with an exception.

* Where:
Script 'D:\weex\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 899

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\weex\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 42s
Exception: Gradle task assembleDebug failed with exit code 1
阅读 5.5k
3 个回答

你的 flutter 是 1.20.0+ 吧。DiagnosticableMixin 被移除了。
所以你引用的 package 无法编译。

解决方案:

  1. 使用 flutter 的 stable 版本。
  2. fork 那个 package ,将 DiagnosticableMixin 替换为 Diagnosticable。
  3. 临时使用我的 fork

flutter_datetime_picker 依赖 flutterDiagnosticableMixi方法 ,但是最新版的flutter 已经移除了DiagnosticableMixi方法

1、dev 版本的截止目前还可以正常使用 ,flutter channel dev试试
2、或者去 flutter_datetime_picker 看看版本升级的问题有没有解决 如果解决了,升级flutter_datetime_picker到最新版

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏