You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter依赖包冲突求助:无法升级package_info_plus至4.0.2

Flutter依赖冲突解决:无法更新package_info_plus至4.0.2版本

我有一个长期未更新的Flutter应用,需要将package_info_plus包从1.4.2版本更新至4.0.2版本(该包的已知问题已在新版本中修复)。但更新时发现需要同步更新其他依赖包,部分包无法更新导致整个流程受阻。

已成功更新的依赖包

environment:
  sdk: '>=3.0.6 <4.0.0'

dependencies:
  line_icons: ^2.0.3
  maps_launcher: ^2.2.0 # REMOVED, USE OTHER INSTEAD
  uuid: ^3.0.7 # IDs for events
  cloudinary_public: ^0.21.0
  showcaseview: ^2.0.3 # help for new users
  provider: ^6.0.5
  cloud_firestore: ^4.8.4
  firebase_core: ^2.15.0 # needs Runner/GoogleService-Info.plist
  firebase_auth: ^4.7.2 # needs Runner/GoogleService-Info.plist
  firebase_analytics: ^10.4.4 # needs Runner/GoogleService-Info.plist
  google_sign_in: ^6.1.4 # needs Info.plist modification
  badges: ^3.1.1
  flutter_translate: ^4.0.4
  sign_in_with_apple: ^5.0.0 # needs Xcode modification
  shared_preferences: ^2.2.0
  jiffy: ^6.2.1 # date manipulation
  permission_handler: ^10.4.3 # needs Info.plist modification
  csv: ^5.0.2
  path_provider: ^2.0.15
  flutter_email_sender: ^6.0.1
  flutter_launcher_icons: ^0.13.1
  image_picker: ^1.0.1 # for camera
  image: ^4.0.17
  url_launcher: ^6.1.12 # needs Info.plist modification
  transparent_image: ^2.0.1
  cached_network_image: ^3.2.3
  carousel_slider: ^4.2.1
  flutter_slidable: ^3.0.0
  flutter_svg: ^2.0.7
  table_calendar: ^3.0.9
  add_2_calendar: ^2.2.4 # Info.plist modification
  in_app_purchase: ^3.1.7 # official one.
  flutter_platform_widgets: ^3.3.5
  flutter_native_splash: ^2.3.1
  intl_phone_number_input: ^0.7.3+1
  country_pickers: ^2.0.0
  currency_picker: ^2.0.16
  reorderables: ^0.6.0 # reorder rent fields
  pdf: ^3.10.4
  printing: ^5.11.0 # necessary for the above one
  open_file_safe: ^3.2.3 # necessary for the above one
  fimber: ^0.7.0
  fluttercontactpicker: ^4.7.0
  contacts_service: ^0.6.3 # get contacts. Info.plist modification
  stack_appodeal_flutter: ^3.0.2
  firebase_messaging: ^14.6.5
  firebase_performance: ^0.9.2+4
  after_layout: ^1.2.0
  timezone: ^0.9.2

存在更新问题的依赖包

#  flutter_local_notifications: ^12.0.0
  device_info_plus: ^4.0.0
  package_info_plus: ^1.4.2
  file_picker: ^4.2.7 # for multiple images selection
#  intl: ^0.18.0 # locales for table_calendar and datetime manipulation
  share_plus: ^4.0.10
#  http: ^0.13.4
#  flutter_facebook_auth: ^5.0.11

注释掉的包已更新至最新版本

dependency_overrides配置

dependency_overrides:
#  flutter_local_notifications: ^15.1.0+1
#  device_info_plus: ^9.0.2
#  package_info_plus: ^4.0.2
  intl: ^0.18.1
#  share_plus: ^7.0.2
  http: ^1.1.0
  flutter_facebook_auth: ^6.0.0

注释掉的项是无法通过任何方式更新的包,手动更新后package_info_plus仍停留在1.4.2版本。

Flutter Doctor检测结果

• Android SDK at /Users/dani/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Users/dani/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.11.3

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

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] Android Studio (version 2021.3)
    • Android Studio at /Users/dani/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[✓] VS Code (version 1.69.2)
    • VS Code at /Users/dani/Downloads/Visual Studio Code.app/Contents
    • Flutter extension version 3.60.0

[✓] Connected device (3 available)            
    • Android SDK built for arm64 (mobile) • emulator-5554 • android-arm64  • Android 10 (API 29) (emulator)
    • macOS (desktop)                      • macos         • darwin-arm64   • macOS 13.3.1 22E772610a darwin-arm64
    • Chrome (web)                         • chrome        • web-javascript • Google Chrome 115.0.5790.114

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Flutter已更新至最新版本

请问有什么解决这些依赖冲突的方法?

内容的提问来源于stack exchange,提问作者Dani

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.15 00:39:51