Home > front end >  Does dart pub upgrade, upgrades all dependencies or we have to manually change for those who got bre
Does dart pub upgrade, upgrades all dependencies or we have to manually change for those who got bre

Time:12-18

Suppose I have analyzer package that is a transitive dependency set to 2.8.0^ and latest version 3.0.0 is available.So using dart pub upgrade will upgrade it or I have to manually make it ^3.0.0 in pubspec.yaml and then run pub get

CodePudding user response:

It will automatically update the dependencies when you use dart pub upgrade

If there is a dependency say ^2.7.0 with you and there is a newer version (2.8.0) available, it will automatically upgrade to ^3.0.0 unless there is any dependency constraints.

You could use dart pub upgrade --major-versions so that ^2.8.0 can be upgraded to ^3.0.0.

Anyway you'll be suggested to use this command when using dart pub upgrade

I was upgrading webview_flutter from ^2.8.0 to 3.0.0:

  1. I had to run dart pub upgrade (checked what new dependencies are there).
  2. It suggested me to run dart pub outdated.
  3. I saw webview_flutter was not upgraded.
  4. It suggested me to run dart pub upgrade --major-versions.
  5. I did it, and the version upgraded in .yaml file

Look here for more about the command.

  • Related