Issue
I have a couple of small dart demo projects together in one git repository. Thus each project is in a subfolder of the repository and the yaml files of each of these projects is in the corresponding folder, not under the root of the repo. Is there a way to specify a git dependency to such a subfolder within a git repo? I know that I can clone the repository manually and use a file path in the dependency specification. But what I’m looking for is a way to have a direct git url for that package in a subdir. Is this possible?
Solution
Several years on, support for this has been added:
https://github.com/dart-lang/pub/pull/1650
You can now split the git
dependency into a url
and path
:
dependencies:
protobuf:
git:
url: git://github.com/dart-lang/protobuf.git
path: protobuf
Further reading: https://dart.dev/tools/pub/dependencies#git-packages
Answered By – Danny Tuppeny
Answer Checked By – Willingham (FlutterFixes Volunteer)