The hard way

We recommend you use the onepub pub add command to add a dependency. However, you can also add the dependency by hand.

Manually configure a OnePub dependency

The onepub pub add command simply adds a hosted dependency to your pubspec.yaml which of course you can also do manually (but why would you?).

For each private package that your project depends on, you can add a hosted key.

Copy the 'publish_to' URL from your OnePub profile page:

Now paste it into the 'hosted' key for the package.

dependencies: 
  my_private_package:
    version: 1.0.2
    hosted: https://onepub.dev/api/xxxxxxxx

If your dart version is older than 2.15, then you must use the older hosted format.

dependencies: 
  my_private_package:
    version: 1.0.2
    hosted: 
      name: my_private_package
      url: https://onepub.dev/api/xxxxx

Last updated