首页 > 解决方案 > 更新颤振 SDK 2.0 后出现错误 DiagnosticableMixin

问题描述

更新颤振 SDK 2.0 后,我遇到了以下错误。

../../SDK/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_cupertino_date_picker-1.0.26+2/lib/src/date_picker_theme.dart:23:32:错误:输入'DiagnosticableMixin'不是成立。类 DateTimePickerTheme 与 DiagnosticableMixin { ^^^^^^^^^^^^^^^^^^ ../../SDK/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_cupertino_date_picker-1.0 .26+2/lib/src/date_picker_theme.dart:23:7: 错误:不能混入“DiagnosticableMixin”类型。Class DateTimePickerTheme with DiagnosticableMixin { ^ ../../SDK/flutter/.pub- cache/hosted/pub.dartlang.org/flutter_cupertino_date_picker-1.0.26+2/lib/src/date_picker.dart:103:34:错误:没有名为“shadowThemeOnly”的命名参数。主题:Theme.of(context, shadowThemeOnly: true), ^^^^^^^^^^^^^^ ../../SDK/flutter/packages/flutter/lib/src/material/theme.飞镖:107:20:上下文:找到了这个候选人,但论点不匹配。(BuildContext上下文)的静态主题数据{

标签: androidfluttersdk

解决方案


检查 flutter_cupertino_date_picker 库。date_picker_theme.dart 文件有以下代码。

 class DateTimePickerTheme with DiagnosticableMixin {
  }

在 Flutter 2.0 版本中,他们删除了 falvor DiagnosticableMixin。所以用 Diagnosticable 移除 DiagnosticableMixin。按照以下代码更改 date_picker_theme.dart 文件。

  class DateTimePickerTheme with Diagnosticable {
  }

推荐阅读