Central version management for several Flutter packages

Viewed 151

In our Flutter app we tried to move implementation of several features in their own packages.

Everything is working well, but there is one thing I would like to improve.

Some features use same third party libraries => ie. there are same dependencies in the pubspec.yaml

But that also means, everytime we need to update the version of a third party library we need to do this in all packages.

Is it possible to have a central file containing all dependency versions as variables that could be used in the corresponding pubspec.yaml files?

Or maybe there is any other workaround?

1 Answers

Well I believe what you could do is instead of specifying a definite version of the third party library you could use the caret sign(^) in front of your third party library version (What is the caret sign (^) before the dependency version number in Flutter's pubspec.yaml?)

Since the caret sign, specifies that when you flutter pub upgrade you update the library up to the last non-breaking version, it should fix your issue.

And when a breaking version is coming along you do not want it to be updated everywhere anyway, since you need to test and modify every package individually, to make sure that it works properly. Does that sound like a correct answer ?

Related