I would like to organise a flutter project into a multi-package one with following requirements:
The file setup for the repository I have now is:
.
├── app_base
│ ├── ...
│ └── pubspec.yaml
├── feature
│ ├── ...
│ └── pubspec.yaml
└── README.md
I tried using path dependencies like this in app_base/pubspec.yaml
:
name: app_base
dependencies:
feature:
path: ../feature
and it works for local development but if I try to use app_base
in a completely different project and not use paths but a git dependency:
name: actual_app
dependencies:
app_base:
git:
url: ssh://address.to/the_repo.git
path: app_base
ref: deadbaca
it cannot resolve the transitive feature
dependency:
Running "flutter packages get" in actual_app...
Error on line 21, column 11: Invalid description: "../feature" is a relative path, but this isn't a local pubspec.
path: ../feature
^^^^^^^^^^
pub get failed (65)
Process finished with exit code 65
Is there a way to make it work for both local development and used as a git dependency from other project?
Just use Git dependencies for both scenarios (locally and for other projects).
If you think this is cumbersome during local development, use path dependencies locally and change it back to Git before committing.
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