package_info_plus flutter 包与其他 flutter 包不兼容

问题描述 投票:0回答:1

使用

package_info_plus
包时,我的 Flutter 项目中面临依赖冲突。出现这个问题是因为
package_info_plus
http
包有特定的版本要求,这与我项目中的其他包不兼容。尽管多次尝试通过调整特定版本来解决冲突,但我仍然找不到兼容的组合。我需要帮助来解决这些冲突或找到替代包来检索包信息而不删除其他依赖项。谢谢。

environment:
  sdk: '>=3.1.0 <4.0.0'

dependencies:
  flutter:
    sdk: flutter
  file: ^7.0.0
  shared_preferences: ^2.0.13
  flutter_localizations:
    sdk: flutter
  intl: any
  get_storage: ^2.1.1
  get_cli: ^1.8.1
  local_session_timeout: ^2.3.1
  go_router: ^14.1.2
  casbin: ^0.1.0
  jwt_decoder: ^2.0.1
  flex_color_scheme: ^7.3.1
  one_clock: ^2.0.1
  cupertino_icons: ^1.0.2
  flutter_dotenv: ^5.1.0
  json_serializable: ^6.7.1
  firebase_core: ^2.24.2
  firebase_messaging: ^14.7.9
  openid_client: ^0.4.8
  hive: ^2.2.3
  hive_flutter: ^1.1.0
  flutter_svg: ^2.0.10+1
  http: ^1.2.0
  flutter_json_view: ^1.1.4
  get: ^4.6.6
  url_launcher: ^6.2.5
  internet_connection_checker_plus: ^2.3.0
  json_annotation: ^4.9.0
  dio: any
  provider: ^6.1.2
  freezed_annotation: ^2.4.1
  footer: ^0.0.4
  font_awesome_flutter: ^10.7.0

我尝试更新 http 和 internet_connection_checker_plus 等冲突包的版本限制来解决依赖冲突。我还尝试排除某些依赖项以查看它是否重新解决了冲突,但这导致了我的项目中的其他问题。

但是都没有效果..

错误

因为 get_cli >=1.8.3 依赖于 intl ^0.18.0 并且没有版本 get_cli 匹配 >1.8.1 <1.8.3, get_cli >1.8.1 需要 intl ^0.18.0。 并且因为 get_cli 1.8.1 依赖于 cli_dialog >=0.5.0 <1.0.0, get_cli >=1.8.1 需要 intl ^0.18.0 或 cli_dialog >=0.5.0 <1.0.0. (1) So, because no versions of cli_dialog match >0.5.0 <1.0.0 and cli_dialog 0.5.0 depends on dart_console ^1.0.0, get_cli >=1.8.1 需要 intl ^0.18.0 或 dart_console ^1.0.0。

Because no versions of dart_console match >1.0.0 <1.1.0-pre.0 and dart_console >=1.1.0-pre.0 <1.2.0 depends on intl ^0.17.0,

dart_console >1.0.0 <1.2.0 requires intl ^0.17.0. And because dart_console >=1.2.0 <4.0.0 depends on intl ^0.18.0 and dart_console 1.0.0 depends on win32 ^2.0.0, dart_console >=1.0.0 <4.0.0 requires win32 ^2.0.0 or intl ^0.17.0 or ^0.18.0. And because get_cli >=1.8.1 需要 intl ^0.18.0 或 dart_console ^1.0.0 (1),get_cli >=1.8.1 需要 intl ^0.17.0 或 >=0.18.0 <0.19.0 or win32 ^2.0.0. And because package_info_plus >=4.0.1 取决于 win32 >=4.0 .0 <6.0.0, if package_info_plus >=4.0.1 且 get_cli >=1.8.1 然后 intl ^0.17.0 或 >=0.18.0 <0.19.0. And because mes_line_in depends on flutter_localizations from sdk which depends on intl 0.19.0, package_info_plus >=4.0.1 是 与 get_cli >=1.8.1 不兼容。 因此,由于 mes_line_in 依赖于 get_cli ^1.8.1 和 package_info_plus ^7.0.0,版本解析失败。

flutter dart flutter-dependencies dart-pub
1个回答
0
投票

尝试从项目根目录中删除

pubspec.lock
文件并在终端中运行
flutter pub get
命令。

我相信这将解决您项目的依赖冲突。

© www.soinside.com 2019 - 2024. All rights reserved.