Update To/install Latest Flutter Packages (pubspec.yaml)
Solution 1:
Yes it is possible to update existing packages. Use the flutter command below:
flutter pub outdated
This was introduced in Dart 2.8:
As of Dart 2.8, you can use
pub outdated, a new tool for automatically determining which of your dependencies need to be updated to the latest and greatest versions.
Solution 2:
With a release of Flutter 2.0 you can now upgrade flutter dependency packages automatically using these below command lines:
flutter pub outdatedflutter pub upgrade --major-versions
Solution 3:
Let's say you have these packages in your pubspec.yaml file
dependencies:foo:^1.0.0bar:^5.0.0And at some point in future there is an update available for both of them, and you decide to run
flutter pub outdated
It would now list something like:
Dependencies Current Upgradable Resolvable Latest
foo 1.0.01.2.01.2.01.2.0
bar 5.0.05.3.06.0.06.0.0You see there is no breaking change for foo, since it is still on 1.x.x, however, bar has got a breaking change, it has been updated from 5.x.x to 6.x.x. So what should you do now?
If you safely want to update the packages without breaking your code, run
flutter pub upgradeThis would now create
pubspec.lockfile withpackages:foo:version:"1.2.0"bar:version:"5.3.0"If you want to update both of them to the latest version, you'll have to manually do it in
pubspec.yamlfile by specifying (foowon't need manual version):dependencies:bar:^6.0.0This would create
pubspec.lockfile withpackages:foo:version:"1.2.0"bar:version:"6.0.0"
Solution 4:
You can check version is out dated or not using flutter pub outdated command.
in output you will get all outdated versions.
Output:
Dependencies Current Upgradable Resolvable Latest
carousel_pro *0.0.13 *0.0.13 1.0.0 1.0.0
firebase_auth *0.15.4 *0.15.5+3 0.16.0 0.16.0
Here, current version show, which you are using and latest show which package version is available.
Note: You have to specify latest version in pubspec.yaml file and then you have to run.
flutter pub get
Post a Comment for "Update To/install Latest Flutter Packages (pubspec.yaml)"