首页 > 解决方案 > 您如何强制“pub get”从 git 获取最新信息?

问题描述

我的 pubspec.yaml 文件中有一个 git 依赖项,如何在 git 存储库中发生新更改时强制更新它?

flutter pub get / pub get

它没有得到最新的,因为它是.pub-cache/git/

有没有办法强制从 pubspec.yaml 中引用的 git repo 更新特定依赖项?

标签: dartflutter

解决方案


在您的pubspec.yaml中,您可以指定特定的 git 提交:

dependencies:
  http2:
    git:
      url: https://github.com/dart-lang/http2.git
      ref: c31df28c3cf076c9aacaed1d77f45b66bb2e01a6

或者,如果您仅在“ref”中指定一个分支:

dependencies:
  http2:
    git:
      url: https://github.com/dart-lang/http2.git
      ref: master

您需要强制更新flutter packages upgrade


推荐阅读