Why are the dependencies are incompatible with each other?

I'm trying to build a custom map widget with the use of 4 different packages. But when trying to compile I get trouble with compatibility of the different dependencies. And I'm struggling figuring out where the problem is.

The four packages are:

https://pub.dev/packages/flutter_map
https://pub.dev/packages/latlong2
https://pub.dev/packages/flutter_map_location_marker
https://pub.dev/packages/geolocator

Just adding these as dependencies to a custom widget gives me a strange error - without any other code than the boilerplate widget code present in the widget.

Error: Failed running flutter pub get...

Because custom_widget depends on flutter_map_location_marker ^8.0.2 which depends on geolocator ^10.1.0, geolocator ^10.1.0 is required.

So, because custom_widget depends on geolocator 9.0.1, version solving failed.

You can try the following suggestion to make the pubspec resolve:

* Try an upgrade of your constraints: flutter pub upgrade --major-versions

I'm adding the dependencies as:

flutter_map: ^6.0.1
latlong2: ^0.9.0
flutter_map_location_marker: ^8.0.2
geolocator: ^10.1.0

So the error indicates that my custom widget is using geolocater 9.0.1 even if I have specified ^10.1.0

If I set the dependency versions as "any" it seems to compile. But then I'm downgraded to what seems to be flutter_map: 3.0.0 which is incompatible with the features I'm trying to use.

I have tried to figure out what might be the cause of incompatibility in such a way that I'm downgraded to v3, by for instance trying to lower the flutter_map_location_marker to ^7.0.0, since that was the first indicated issue (incompadibility with geolocater package 9 or 10) But then I get even stranger dependency errors:

Error: Failed running flutter pub get...

Because google_fonts >=2.0.0-nullsafety.0 <4.0.5 depends on http ^0.13.0 and flutter_map >=5.0.0 depends on http ^1.0.0, google_fonts >=2.0.0-nullsafety.0 <4.0.5 is incompatible with flutter_map >=5.0.0.

So, because custom_widget depends on both flutter_map ^6.0.1 and google_fonts 4.0.3, version solving failed.

You can try the following suggestion to make the pubspec resolve:

* Try an upgrade of your constraints: flutter pub upgrade --major-versions

Which does'nt make sense to me at all, since the google_font package is a standard package in my .yaml file, and nothing I have added as a custom package. My .yaml file has google_fonts: 4.0.3

What can I do in order to figure out how to solve this, and which package is potentially the problem?

The error message from the compiler is suggesting to: Try an upgrade of your constraints: flutter pub upgrade --major-versions Where can I run that in flutterflow?

6
1 reply