错误:'DatePickerTheme' is imported from 'material/date_pickerTheme.dart' & 'flutter_datetime_pickerTheme.dart'

kcrjzv8t  于 2023-05-18  发布在  Flutter
关注(0)|答案(2)|浏览(1078)

我不能建立我的项目升级后我的Flutter。我把flutter从3.0.1升级到3.10.0
调试控制台显示:

/C:/Users/USER/AppData/Local/Pub/Cache/hosted/pub.dev/form_builder_extra_fields-8.3.0/lib/src/fields/form_builder_cupertino_date_time_picker.dart:6:1: Error: 'DatePickerTheme' is imported from both 'package:flutter/src/material/date_picker_theme.dart' and 'package:flutter_datetime_picker_bdaya/src/datetime_picker_theme.dart'.
import 'package:flutter_datetime_picker_bdaya/flutter_datetime_picker_bdaya.dart';
flutter_datetime_picker_bdaya.dart:1
^^^^^^^^^^^^^^^
/C:/Users/USER/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_datetime_picker_bdaya-2.0.0/lib/flutter_datetime_picker_bdaya.dart:7:1: Error: 'DatePickerTheme' is imported from both 'package:flutter/src/material/date_picker_theme.dart' and 'package:flutter_datetime_picker_bdaya/src/datetime_picker_theme.dart'.
import 'src/datetime_picker_theme.dart';
^^^^^^^^^^^^^^^
/C:/Users/USER/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_datetime_picker_bdaya-2.0.0/lib/flutter_datetime_picker_bdaya.dart:200:31: Error: 'DatePickerTheme' is imported from both 'package:flutter/src/material/date_picker_theme.dart' and 'package:flutter_datetime_picker_bdaya/src/datetime_picker_theme.dart'.
        this.theme = theme ?? DatePickerTheme(),
                              ^^^^^^^^^^^^^^^
/C:/Users/USER/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_chips_input-2.0.0/lib/src/chips_input.dart:87:7: Error: The non-abstract class 'ChipsInputState' is missing implementations for these members:
 - TextInputClient.didChangeInputControl
 - TextInputClient.insertContent
 - TextInputClient.performSelector
Try to either
 - provide an implementation,
 - inherit an implementation from a superclass or mixin,
 - mark the class as abstract, or
 - provide a 'noSuchMethod' implementation.

class ChipsInputState<T> extends State<ChipsInput<T>>

      ^^^^^^^^^^^^^^^
/D:/Flutter/flutter/packages/flutter/lib/src/services/text_input.dart:1158:8: Context: 'TextInputClient.didChangeInputControl' is defined here.
  void didChangeInputControl(TextInputControl? oldControl, TextInputControl? newControl) {}
       ^^^^^^^^^^^^^^^^^^^^^
/D:/Flutter/flutter/packages/flutter/lib/src/services/text_input.dart:1117:8: Context: 'TextInputClient.insertContent' is defined here.
  void insertContent(KeyboardInsertedContent content) {}
       ^^^^^^^^^^^^^
/D:/Flutter/flutter/packages/flutter/lib/src/services/text_input.dart:1179:8: Context: 'TextInputClient.performSelector' is defined here.

  void performSelector(String selectorName) {}
       ^^^^^^^^^^^^^^^
Target kernel_snapshot failed: Exception
FAILURE: Build failed with an exception.

* Where:
Script 'D:\Flutter\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'D:\Flutter\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 6s
Exception: Gradle task assembleDebug failed with exit code 1

我导入的包是:

cupertino_icons: ^1.0.2
  firebase_core_platform_interface: ^4.8.0
  firebase_core: ^2.13.0
  firebase_storage: ^11.2.1
  file_picker: ^5.2.6
  datetime_picker_formfield: 
  firebase_messaging: ^14.6.1
  overlay_support: ^2.0.1
  cloud_firestore: ^4.7.1
  firebase_auth: ^4.6.1
  flutter_facebook_auth:
  intl: ^0.17.0
  csc_picker: 
  google_sign_in:
  image_picker: ^0.8.5+3
  get:
  google_maps_flutter: ^2.2.0
  flutter_native_splash: ^1.2.0
  geolocator: 
  flutter_map:
  flutter_map_marker_cluster:
  http:
  geocoding: ^2.1.0
  flutter_polyline_points: ^1.0.0
  map_location_picker: ^1.1.0

我的Flutter医生

  • [√] Flutter(通道稳定,3.10.0,在Microsoft Windows [版本10.0.19044.2965]上,区域设置en-US)
  • [√] Windows版本(安装的Windows版本为10或更高版本)
  • [√] Android工具链-为Android设备开发(Android SDK版本33.0.0-rc 2)
  • [√] Chrome -为Web开发
  • [√] Visual Studio -为Windows开发(Visual Studio Community 2022 17.0.0)
  • [√] Android Studio(版本2021.2)
  • [√] VS Code(版本1.78.2)
  • [√]连接设备(4个可用)
  • 【√】网络资源

我已经尝试过清洁项目,升级酒吧包和Flutter酒吧缓存修复,但它仍然是一样的。还有什么其他的解决方案可以使用吗?

lymgl2op

lymgl2op1#

请避免使用屏幕截图,并将错误复制粘贴到问题中。
ChipsInput小部件中,您使用了两个相互冲突的导入。在调用this.theme = theme ?? DatePickerTheme()时会发生冲突,因为它不知道使用哪个导入,因为它们具有相同的名称。
您需要删除import 'package:flutter/src/material/date_picker_theme.dart'import 'package:flutter_datetime_picker_bdaya/src/datetime_picker_theme.dart'
或者,您可以尝试使用as重命名1个导入,如下所示:

import 'package:flutter_datetime_picker_bdaya/src/datetime_picker_theme.dart' as example

example.DatePickerTheme()
nmpmafwu

nmpmafwu2#

对不起,我已经解决了这个问题,通过使用flutter pub upgrade-major-versions和删除一些软件包,所以它得到These packages are no longer being depended on: - flutter_chips_input 2.0.0 - flutter_datetime_picker_bdaya 2.0.0 - flutter_touch_spin 2.0.0 - google_maps_webservice 0.0.20-nullsafety.5

相关问题