升级 flutter 后包无法在 pub 中解决

Package can't solving in pub after upgrade flutter

在我的应用中,我使用了一些包

environment:
  sdk: ">=2.2.2 <3.0.0"
module:
  androidX: true

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: 1.0.0
  google_maps_flutter: 1.0.3
  google_map_location_picker: 4.0.0
  mvc_pattern: 6.3.0
  global_configuration: 1.6.0
  http: 0.12.2
  html: 0.14.0+4
  shared_preferences: ^0.5.12+2
  flutter_html: 1.0.2
  flutter_svg: 0.18.1
  location: 3.0.2
  webview_flutter: 0.3.24
  url_launcher: 5.7.7
  firebase_messaging: 7.0.3
  cached_network_image: 2.3.3
  fluttertoast: 4.0.1
  flutter_staggered_grid_view: 0.3.2
  intl_utils: 1.8.0
  carousel_slider: 2.3.1
  cloud_firestore: 0.14.1+3
  firebase_auth: 0.18.1+2
  firebase_core: 0.5.0+1

现在我的酒吧出现了一些错误

因为 google_map_location_picker >=3.3.1 <4.1.3 依赖于 intl >=0.16.0 <=0.16.1 并且来自 sdk 的 flutter_localizations 的每个版本都依赖于 intl 0.17.0 , google_map_location_picker >=3.3.1 <4.1.3 与 sdk 中的 flutter_localizations 不兼容。

所以,因为food_app同时依赖flutter_localizations any from sdk和google_map_location_picker 4.0.0,所以版本解析失败。 pub get failed (1; 所以,因为 food_app 同时依赖 flutter_localizations any from sdk 和 google_map_location_picker 4.0.0,版本解析失败。)

我正在尝试对包使用 any,但它会产生更多错误

所以,我该如何处理这个问题!

嘿,我也多次遇到这种问题。并且只有一种解决方案是为包提供范围。 例如:

  flutter_polyline_points: ">=0.2.4 < 0.3.0"
  google_maps_flutter: ">=0.0.1 < 2.0.1"

原因:这里你的包自动选择稳定包版本.

确保选择你的左限尽可能低的版本,右限是最新版本。 您可以在文档的版本部分检查版本。