6

I want to add one flutter plugin in github as dependency to another flutter project.

i have followed the code https://flutter.dev/docs/development/packages-and-plugins/using-packages#dependencies-on-unpublished-packages and added a ref tag as mentioned here https://dart.dev/tools/pub/dependencies#git-packages

dependencies:
  mypluginname:
    git:
      url: http://mywebsite/myproject.git
      ref: master

i expect to fetch the latest commit of this branch(master), but it fetches first commit.

4 Answers 4

7

Specifying the concrete commit like below helped me:

dependencies:
  mypluginname:
    git:
      url: http://mywebsite/myproject.git
      ref: fad1b1dece2980dab850fc5128ae3c139963c0be
Sign up to request clarification or add additional context in comments.

Comments

2

deleting the cache files in flutter_sdk_install_directory/.pub_cache/git/my_project and then doing packages upgrade on the flutter project worked for me.

Comments

0

you can

  1. comment out the plugin in pubspec.yaml
  2. run -> flutter packages get
  3. uncomment and repeat step 2)

Comments

0

To complete Tomas' answer. Use path field to point to a specific directory. Example:

dependencies:
  menubar:
    git:
      url: https://github.com/google/flutter-desktop-embedding.git
      path: plugins/menubar
      ref: master

Run this flutter pub get to install it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.