在最新的测试版Ffltter(v1.17)中,现在有一个pub
命令可以判断和更新过时的依赖项.
要判断过时的依赖关系,请运行以下命令:
$ 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.
这会产生如下输出:
$ 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.
要使用兼容的依赖项进行更新,请运行:
flutter pub upgrade
或者要使用可能 destruct 性的更改进行更新,请使用
flutter pub upgrade --major-versions