TL;DR: Yes you can host your own package servers and pull packages from them.
Let me clear up some (as yet undocumented) terminology:
A source in Pub lingo is a kind of thing that Pub knows how to pull packages from. For each source, there is unique code in Pub to know how to talk to it. Right now, Pub has three sources: Git, the SDK, and repo.
From pub's perspective, github and bitbucket aren't different sources, they're just different URLs that the one Git source can pull from.
The
"repo" source is for pulling packages from
pub.dartlang.org. But, more generally, it's for pulling packages from
any URL that happens to speak the same HTTP API that
pub.dartlang.org does.
When you add a dependency for a package, you specify the source, and then any data the source needs (called the "description"), like so:
dependencies:
some_package:
sdk: some_package
For SDK sourced packages, the description is just the name of the package.
If you don't specify a source, it assumes the default source, which is "repo". For repo packages, the description can include an alternate URL where the repo is located. If that's omitted, it defaults to
pub.dartlang.org. But you
can specify it manually, like so:
dependencies:
some_package:
repo:
name: some_package
This is implemented now. Private package repositories were something we definitely had in mind. Big companies often want their own repositories that they serve packages from and we wanted to enable that.
There is still the problem that you have to manually specify the URL to that server in each dependency. At some point, we may add something more global like an environment variable that pub will look for to see the package repository URL globally.
- bob