在Flutter中查找和版本过时的软件包(跨主要版本) [英] Find and version bump outdated packages in Flutter (across major versions)

查看:264
本文介绍了在Flutter中查找和版本过时的软件包(跨主要版本)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有办法列出和更新pubspec.yaml中已超过主要版本的软件包? (例如 NPM中使用的方法

Is there a way to list and update packages that have crossed a major version in pubspec.yaml? (like this method used in NPM)

例如当pubspec.yaml文件具有 built_value 时:

E.g. when the pubspec.yaml file has this with built_value:

dependencies:
  flutter:
    sdk: flutter
  built_value: ^5.0.0

built_value 更新到版本 ^ 6.2.0 时,可以通过主要版本进行升级,因此pubspec.yaml更新为:

When built_value is updated to version ^6.2.0 is there a way to upgrade past the major version so the pubspec.yaml is updated to:

dependencies:
  flutter:
    sdk: flutter
  built_value: ^6.2.0

我知道我可以手动检查每个软件包的主要版本,但是这样做

I know I can manually check each package for major versions, but it would be helpful if it was automatic.

推荐答案

在最新的Flutter Beta版本(v1.17)中,现在有一个 pub 命令检查过时的依赖关系,例如

With the latest beta versions of Flutter (v1.17) there is now a pub command to check for outdated dependencies, e.g.

$ 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中查找和版本过时的软件包(跨主要版本)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆