shamblett / mqtt_client

A server and browser based MQTT client for dart
Other
543 stars 176 forks source link

Dependency Resolution Failure after upgrading to 10.4.0 #551

Closed rpungin closed 2 weeks ago

rpungin commented 1 month ago

I upgraded mqtt_client from 10.2.1 to 10.4.0 and am getting the following error when running flutter pub get:

Because every version of flutter_test from sdk depends on meta 1.12.0 and mqtt_client >=10.3.1 depends on meta ^1.15.0, flutter_test from sdk is incompatible with mqtt_client >=10.3.1.
So, because bdl_flutter_pubsub depends on both mqtt_client ^10.4.0 and flutter_test from sdk, version solving failed.

This is the output of flutter --version:

Flutter 3.22.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 761747bfc5 (6 weeks ago) • 2024-06-05 22:15:13 +0200
Engine • revision edd8546116
Tools • Dart 3.4.3 • DevTools 2.34.3
rpungin commented 1 month ago

I also use meta package in my other project and tried updating it from 1.12.0 to 1.15.0, but then got an error:

Note: meta is pinned to version 1.12.0 by flutter_test from the flutter SDK.
See https://dart.dev/go/sdk-version-pinning for details.

Because every version of flutter_test from sdk depends on meta 1.12.0 and bdl_flutter_core depends on meta ^1.15.0, flutter_test from sdk is forbidden.
So, because bdl_flutter_core depends on flutter_test from sdk, version solving failed.

You can try the following suggestion to make the pubspec resolve:
* Consider downgrading your constraint on meta: flutter pub add meta:^1.12.0

Is it possible to downgrade to meta 1.12.0 in the dependencies of this package?

shamblett commented 1 month ago

I feel your pain but sorry no, if the Google guys are going to persist in pinning releases of flutter to specific versions of dependent packages then things like the are going to happen.

You shouid be able to stay at 10.3.1 unless of course you wanted to take advantage of the new functionality added in 10.4.0 which you won't be able to do until flutter catches up(or even better removes this frankly ridiculous behaviour).

rpungin commented 1 month ago

So how are you able to use meta 1.15.0 and have all your dependencies resolved? Why do I have the problem and you don't? I am running the latest version of flutter 3.22.2. My co-worker also has the same problem. Is there a workaround ?

shamblett commented 1 month ago

I don't have the problem because mqtt_client is a Dart package, from its pub page you can see its targeted at server side(VM, flutter) and the web(browser and soon to be web assembly). Its only when you use it with flutter you have this problem.

There is no work around as far as the client is concerned, you could try a dev version of flutter, it may have upgraded its package dependencies.

What particular feature do you need in 10.4 that's not in 10.3.1, only two issues have been added, 524 and 531.

ArnaudMp commented 1 month ago

Hello, this problem is annoying as I'm trying to make mqtt with a web version of flutter and wss. So issue 531 would be rather useful.

rpungin commented 1 month ago

@shamblett , first of all thank you for developing and maintaining this package!

When you say,

its targeted at server side(VM, flutter) and the web(browser and soon to be web assembly).

do you mean that you don't expect it to be used in iOS and Android mobile apps?

shamblett commented 1 month ago

@ArnaudMp - So are your saying your broker set up currently will not allow wss connections without specifying specific headers or are you saying it will but the fix for #531 will be of use to you in the future?

If its the former then you need to wait for flutter to catch up with the real world , note that the MQTT spec does not require any headers to be sent using conformant brokers, wss connections should work without this.

If its the latter then you need to stay as you are now with whatever client version you are using.

@rpungin - No that's not at all what I mean, please refer to the packages pub page I've linked above, the client can be used in flutter and subsequently any of its targets, its just that this version(10.4.0) can't as flutter doesn't allow it.

dmsherazi commented 4 weeks ago

Flutter will pin dependecies for avaoiding breaking changes until they are sure that new versions of the dependencies can compile without issues. Here are some details https://github.com/dart-lang/sdk/blob/main/docs/Flutter-Pinned-Packages.md

Any ways you can always override this try to add meta 1.15.0 by adding the following block to your pubspec.yaml

dependency_overrides: meta: ^1.15.0

and then you can use the latest version