颤振版本解决失败,google_map_location_picker



我试图在flutter项目中添加google_maps_flutter和google_map_location_picker来使用它,但问题是最后一个版本^4.1.7与App中的其他包不兼容,我每次都得到这个错误:

because myapp depends on both image_picker ^0.8.4+2 and google_maps_flutter ^1.1.0, version solving failed.

完全错误:

Because image_picker >=0.7.4 depends on flutter_plugin_android_lifecycle ^2.0.1 and google_maps_flutter >=0.5.22 <2.0.0-nullsafety depends on flutter_plugin_android_lifecycle ^1.0.0, image_picker >=0.7.4 is incompatible with google_maps_flutter >=0.5.22 <2.0.0-nullsafety.
So, because myapp depends on both image_picker ^0.8.4+2 and google_maps_flutter ^1.1.0, version solving failed.
pub get failed (1; So, because myapp depends on both image_picker ^0.8.4+2 and google_maps_flutter ^1.1.0, version solving failed.)

问题不仅存在于image_picker中,而且存在于pubspec中的大多数包中。yaml文件

dependencies:
flutter:
sdk: flutter

# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
flutter_swiper: ^1.1.6
table_calendar: ^2.1.0
google_nav_bar: ^5.0.5
line_icons: ^2.0.1
dio: ^1.0.0
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
fluttertoast: ^8.0.8
carousel_slider: ^4.0.0
flag: ^5.0.1
firebase_core: ^1.6.0
cloud_firestore: ^2.5.3
firebase_storage: ^10.0.4
firebase_auth: ^3.1.1
image_picker: ^0.8.4+2
xfile: ^1.1.0
getwidget: ^2.0.3
path: ^1.8.0
path_provider: ^2.0.5
cached_network_image: ^3.1.0
flutter_datetime_picker: ^1.5.1
url_launcher: ^6.0.12
google_maps_flutter: ^0.5.30
google_map_location_picker: ^3.3.4

是否有一个好的解决方案来避免包版本之间的冲突?

用下面的代码替换pubyaml插件版本。这将消除冲突。

cupertino_icons: ^1.0.2
flutter_swiper: ^1.1.6
table_calendar: ^2.1.0
google_nav_bar: ^5.0.5
line_icons: ^2.0.1
dio: ^1.0.0
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
fluttertoast: ^8.0.8
carousel_slider: ^4.0.0
flag: ^5.0.1
firebase_core: ^0.5.3
cloud_firestore: ^0.5.0
firebase_storage: ^5.0.1
firebase_auth: ^0.6.2+1
image_picker: 0.8.0+4
xfile: ^1.1.0
getwidget: ^2.0.3
path: ^1.8.0
path_provider: ^2.0.5
cached_network_image: ^3.1.0
flutter_datetime_picker: ^1.5.1
url_launcher: ^6.0.5
google_maps_flutter: ^2.0.10
google_map_location_picker: ^4.1.7