I have a git dependency in my pubspec.yaml file, how can I force it to be updated when new changes occur in the git repo?
flutter pub get / pub get
It does not get the latest, as it is in .pub-cache/git/
Is there a way to force a specific dependency to update from a git repo referenced in pubspec.yaml?
To upgrade to a new version of the package, for example to use new features in that package, run flutter pub upgrade (Upgrade dependencies in IntelliJ or Android Studio) to retrieve the highest available version of the package that is allowed by the version constraint specified in pubspec. yaml .
Only do a hard reset if you are the only using the remote repository, or if you haven't yet pushed the commits you're going to drop. Find the commit hash of the commit you want to reset to with git log . Perform the local hard reset by running git reset --hard <commit-hash> .
The “… does not a appear to be a git repository” error is triggered when you try to clone, or run other commands, in a directory that is not recognized as a Git repository. The directory or remote file path might not have initialized Git, or the file path you are trying to access as an active repository is incorrect.
In your pubspec.yaml
, you can specify a particular git commit:
dependencies:
http2:
git:
url: https://github.com/dart-lang/http2.git
ref: c31df28c3cf076c9aacaed1d77f45b66bb2e01a6
Or if you specify only a branch in "ref":
dependencies:
http2:
git:
url: https://github.com/dart-lang/http2.git
ref: master
You need to force the update with flutter packages upgrade
Use
flutter packages upgrade
to get latest.
flutter packages get
only gets latests the first time and writes the resolved versions into pubspec.lock
Subsequent flutter packages get
runs then try to get the versions listed in pubspec.lock
,
while flutter packages upgrade
always ignores pubspec.lock
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With