Flutter 依赖冲突

Flutter dependency conflict

请问我在 flutter 上有依赖冲突,我的问题是它抱怨我没有在 pubspec.yml.

中指定的包

我试过dependency_overrides:但没有解决我的问题,我也尝试删除版本号让flutter决定使用的版本号,但仍然没有解决我的问题。

试了很多平台都没找到解决办法

请帮忙。

这是我的 pubspec.yml 文件

name: airstyl


publish_to: "none" # Remove this line if you wish to publish to pub.dev



https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html

version: 1.0.4+21

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  cloud_firestore:
  firebase_core:
  firebase_auth:
  firebase_database:
  ars_progress_dialog:  #For ios
  progress_dialog:
  intro_screen_onboarding_flutter:
  flutter_svg:
  rate_my_app:
  flutter_markdown:
  animations:
  provider:
  flutter_places_autocomplete: 
  intl:
  firebase_storage:
  image_picker:
  image_cropper:
  file_utils:
  flutter_spinkit:
  cached_network_image:
  like_button:
  syncfusion_flutter_calendar:
  font_awesome_flutter:
  flutter_datetime_picker:
  checkbox_formfield:
  flutter_dropdown:
  multiselect_formfield:
  multi_select_flutter:
  google_maps_webservice:
  flutter_google_places:
  flutter_session:
  fluttertoast:
  flutter_search_bar:
  sweetalert:
  shared_preferences:
  search_page:
  badges:
  sms_autofill:
  flutter_local_notifications:
  timezone:
  pinput:
  google_place:
  animated_list_view_scroll:
  jdate:
  flutter_native_timezone:
  firebase_analytics:
  firebase_crashlytics:
  flutter_email_sender:
  share:
  firebase_dynamic_links:
  group_radio_button:
  package_info:
  flutter_typeahead:
  http:
  connectivity:
  geocoder:
  shimmer:
  upgrader:
  flutter_form_bloc:
  flutter_bloc:
  
  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.0

dev_dependencies:
  flutter_test:
    sdk: flutter
    
   fonts:
    - family: Roboto
      fonts:
        - asset: fonts/Roboto/Roboto-Black.ttf
        - asset: fonts/Roboto/Roboto-BlackItalic.ttf
        - asset: fonts/Roboto/Roboto-Bold.ttf
        - asset: fonts/Roboto/Roboto-BoldItalic.ttf
        - asset: fonts/Roboto/Roboto-Italic.ttf
        - asset: fonts/Roboto/Roboto-Light.ttf
        - asset: fonts/Roboto/Roboto-LightItalic.ttf
        - asset: fonts/Roboto/Roboto-Medium.ttf
        - asset: fonts/Roboto/Roboto-MediumItalic.ttf
        - asset: fonts/Roboto/Roboto-Regular.ttf
        - asset: fonts/Roboto/Roboto-Thin.ttf
        - asset: fonts/Roboto/Roboto-ThinItalic.ttf
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

我遇到的错误

[stylist] flutter pub get
Running "flutter pub get" in stylist...                         
Because mockito >=4.1.1+1 <4.1.2 depends on test_api >=0.2.1 <0.4.0 and mockito >=4.0.0 <=4.1.1 depends on test_api ^0.2.1, mockito >=4.0.0 <4.1.2 requires test_api >=0.2.1 <0.4.0.
And because every version of flutter_places_autocomplete depends on mockito ^4.1.1, every version of flutter_places_autocomplete requires test_api >=0.2.1 <0.4.0 or mockito ^4.1.2.
And because mockito >=4.1.2 <=5.0.0-nullsafety.7 depends on test_api ^0.2.19-nullsafety and every version of flutter_test from sdk depends on test_api 0.4.3, flutter_test from sdk is incompatible with flutter_places_autocomplete.
So, because airstyl depends on both flutter_places_autocomplete any and flutter_test any from sdk, version solving failed.
pub get failed (1; So, because airstyl depends on both flutter_places_autocomplete any and flutter_test any from sdk, version solving failed.)
exit code 1

当我删除 flutter_places_autocomplete 时出现此错误。 注意 E:\ 是我的本地驱动器,不是网络驱动器。

[stylist] flutter pub get
Running "flutter pub get" in stylist...                         
Cannot create link, path = 'E:\flutter_windows_2.5.1-stable\flutter\.pub-cache\_temp\dira20812b9\ios\Classes\FLTPackageInfoPlugin.m' (OS Error: A required privilege is not held by the client.
, errno = 1314)
pub get failed (66; , errno = 1314))
exit code 66

您需要指定依赖的版本。您尚未指定所有依赖项的任何版本。首先指定你的依赖版本和iron pub get。在特定包的依赖性错误之后。根据错误更改版本

清理 flutter 项目。使用,

flutter clean

删除 pubspec.lock 文件。然后获取所有 pub 包,

flutter pub get

我设法通过放回所有包的版本号并将冲突的包留空来解决这个问题,然后我删除了项目中的这个文件夹。

.idea

之后,我删除了 pabspac.lock 文件。之后,我 运行 pub get 并且所有包都已成功下载。非常感谢您的帮助。