Dart:pub get vs pub upgrade [英] Dart: pub get vs pub upgrade

查看:565
本文介绍了Dart:pub get vs pub upgrade的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据 pub get docs pub get pub upgrade 之间的主要区别是:

According to the pub get docs the main difference between pub get and pub upgrade is:


如果lockfile已经存在,pub get使用锁定的依赖的版本。如果一个依赖项没有被锁定,pub将获得满足所有版本约束的那个依赖项的最新版本。这是pub get和pub upgrade之间的主要区别,它总是尝试获取所有依赖项的最新版本。

If a lockfile already exists, pub get uses the versions of dependencies locked in it if possible. If a dependency isn’t locked, pub will get the latest version of that dependency that satisfies all the version constraints. This is the primary difference between pub get and pub upgrade, which always tries to get the latest versions of all dependencies.


  1. 如果依赖关系不是锁定 ... ?锁定?!?在版本控制中?文件系统锁定?这个锁定是什么?

  2. 他们说 pub get 会考虑版本约束, pub upgrade 不会? / li>
  1. What do they mean by "If a dependency isn't locked...? Locked?!? Like in version control? File system lock? What is this lock of which they speak?
  2. Still not clearly understanding the difference between these two commands. Are they saying that pub get takes version constraints into account, and that pub upgrade doesn't?

提前感谢!

推荐答案

pubspec.lock 文件包含此依赖项的条目时,它被锁定
可以更改 pubspec.lock 手动指定要使用的版本
pub upgrade 检查符合 pubspec.yaml 配置并自动更新您的pubspec.lock文件。

It is locked when the pubspec.lock file contains an entry for this dependency. You can change the dependency in pubspec.lock manually to specify exactly what version you want to use. pub upgrade checks for the newest version that fits your pubspec.yaml configuration and updates your pubspec.lock file automatically.

pubspec.lock 在CVS存储库中用您的包代码签入,您以后可以重现与您签入代码时相同的设置,即使您的 pubspec.yaml 允许更多范围的依赖性版本。

when pubspec.lock is checked in with your package code in a CVS repository you are able to later reproduce the exact same setup as you had when you checked in your code even when your pubspec.yaml allowed a wider range of versions for a dependency.

另请参阅

  • Upgrading a dependency
  • In Dart and Pub, should I add pubspec.lock to my .gitignore?

这篇关于Dart:pub get vs pub upgrade的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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