How can you use a Flutter package developed locally as a dependency without having to push the package code every time you make a change?

Viewed 23

I am working on a Flutter app that depends on an internal package where common functionality is extracted.

I have the package as a dependency in the pubspec.yaml as follows:

dependencies:
  package1:
    git:
      url: git://github.com/myproj/packages.git
      path: packages/package1

Everything works fine, but when I have to make a small change in package1, I have to push the code then run flutter pub upgrade in my project which takes quite a while.

How can I depend on an internal package and be able to do the development without having to push the code of the package every time?

1 Answers

You can write it as this to use a local package

dependencies:
  package1:
    path: ../packages/package1
Related