Find and version bump outdated packages in Flutter (across major versions)
With the latest beta versions of Flutter (v1.17) there is now a pub
command to check for, and update, outdated dependencies.
To check for outdated dependencies, run:
$ flutter pub outdated -h
Analyze dependencies to find which ones can be upgraded.
This runs the "pub" tool in a Flutter context.
Usage: flutter pub outdated [<arguments...>]
-h, --help Print this usage information.
Run "flutter help" to see global options.
and this gives output like:
$ flutter pub outdated
Dependencies Current Upgradable Resolvable Latest
path *1.6.4 *1.6.4 *1.6.4 1.7.0
permission_handler *4.4.0+hotfix.4 *4.4.0+hotfix.4 5.0.0+hotfix.3 5.0.0+hotfix.3
dev_dependencies
analyzer *0.36.4 *0.36.4 *0.36.4 0.39.7
build_runner *1.7.4 *1.7.4 *1.7.4 1.9.0
transitive dependencies
asn1lib *0.5.15 *0.5.15 *0.5.15 0.6.4
permission_handler_platform_interface *1.0.0 *1.0.0 2.0.0 2.0.0
transitive dev_dependencies
build *1.1.6 *1.1.6 *1.1.6 1.2.2
build_config *0.4.1+1 *0.4.1+1 *0.4.1+1 0.4.2
dart_style *1.2.9 *1.2.9 *1.2.9 1.3.6
1 upgradable dependency is locked (in pubspec.lock) to an older version.
To update it, use `pub upgrade`.
4 dependencies are constrained to versions that are older than a resolvable version.
To update these dependencies, edit pubspec.yaml.
To update with compatible dependencies, run:
flutter pub upgrade
or to update with potentially breaking changes, use
flutter pub upgrade --major-versions
After release of Flutter 2.0 you can follow these flutter command lines to upgrade dependency packages automatically:
flutter pub outdated
flutter pub upgrade --major-versions
Flutter currently doesn't provide such a feature.
There might be 3rd-party packages that do that.
The only one I know is den
(https://pub.dartlang.org/packages/den), but this one is not maintained since quite some time and can't be used with recent Dart or Flutter versions.
What might help is to at least get a list of dependencies where newer versions are available.
Upvote https://github.com/flutter/flutter/issues/12627 for that.
In the meantime the workaround mentioned in https://github.com/flutter/flutter/issues/12627#issuecomment-400037072 can be used
Set FLUTTER_ROOT
to your Flutter install directory and run pub upgrade
. (this requires the Dart SDK to be installed in addition to the Flutter SDK)
$ export FLUTTER_ROOT="/Users/my_user/flutter"
$ pub upgrade
Resolving dependencies... (16.2s)
! analyzer 0.33.0 (overridden) (0.34.2 available)
args 1.5.1
async 2.0.8
boolean_selector 1.0.4
! build 1.1.0 (overridden)
built_collection 4.1.0
! built_redux 7.5.2 (overridden)
built_value 6.2.0
bwu_grinder_tasks 0.2.0-dev.0
charcode 1.1.2
cli_util 0.1.3+2
collection 1.14.11
contacts_service 0.0.9 (0.1.0 available)
> convert 2.1.1 (was 2.0.2)
crypto 2.0.6
csslib 0.14.6
dart_style 1.2.2
device_info 0.2.1 (0.3.0 available)
> file 5.0.7 (was 5.0.6)
> firebase_analytics 1.1.0 (was 1.0.6)
...