gpt4 book ai didi

dart - 在 Flutter 中查找和版本化过时的包(跨主要版本)

转载 作者:IT老高 更新时间:2023-10-28 12:40:57 26 4
gpt4 key购买 nike

有没有办法在 pubspec.yaml 中列出和更新跨越主要版本的包? (像这样 method used in NPM )

例如当 pubspec.yaml 文件带有 built_value:

dependencies:
flutter:
sdk: flutter
built_value: ^5.0.0

built_value 更新到版本 ^6.2.0 有没有办法升级到主要版本,所以 pubspec.yaml 更新到:

dependencies:
flutter:
sdk: flutter
built_value: ^6.2.0

我知道我可以手动检查每个包的主要版本,但如果它是自动的会很有帮助。

最佳答案

在 Flutter 的最新 beta 版本 (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

或使用潜在的重大更改进行更新,使用

flutter pub upgrade --major-versions

关于dart - 在 Flutter 中查找和版本化过时的包(跨主要版本),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54248570/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com