LogoLogo
  • OnePub
  • Guides
    • Installing
      • Install CLI tools
      • Register
      • Invite a member
      • Accept an Invite
      • CLI integration
        • Manually add publish_to
        • Implicit Integration
      • IDE integration
        • Android Studio
        • Visual Studio Code
      • Pre Dart 2.15
      • Pre Dart 2.12
    • Searching
    • Watching packages
    • Publishing Packages
      • The hard way
    • Private dependencies
      • The hard way
    • CLI Tools
      • login
      • logout
      • doctor
      • export
      • import
      • pub add
      • pub private
      • pub global activate
      • pub global deactivate
    • CI/CD
    • SSH
    • Docker
    • Community Choice Awards
  • Fundamentals
    • Members
    • Teams
    • Roles
    • Naming Packages
  • Workflows
    • Distributing to Customers
      • Purchase a Customer Distribution License
      • Security considerations
      • Publish a package
      • Invite a customer
      • Customer installation instructions
      • Conditions Apply
    • For Support
    • Setting up CI/CD
    • Vendoring Dependencies
    • Switching Organisations
    • Creating a Team Leader
  • FAQ
    • Is GST/VAT/Sales Tax applicable?
    • Does OnePub.dev have access to my personal information?
    • What is your SLA?
    • How do I get support?
    • How do I use OnePub from my CI/CD environment?
    • How to invite team members to join OnePub
    • How to publish a private package
    • 401: Unauthorized
  • Solved by OnePub
  • Data Retention Policy
  • Payments
Powered by GitBook
On this page

Was this helpful?

  1. Guides

Private dependencies

PreviousThe hard wayNextThe hard way

Last updated 2 years ago

Was this helpful?

So you have either published a package to OnePub, one of your colleagues has suggested that you use a package they have published on OnePub or you found a private package whilst searching OnePub.

First, make certain your package is a private package hosted on .

When you perform a package search in OnePub we show both public and private packages.

Public packages should be added to your pubspec.yaml using the standard dart tooling.

When doing a search, OnePub clearly labels private packages in the search results:

In the above screenshot, we have two versions of the cli_menu package. You can clearly tell which version is the private package from the label.

Configure a OnePub dependency

Once you have published a private package to OnePub you are going to want to update your projects to use the package from OnePub.

The simplest way is to use the onepub pub add command.

Use the onepub add command

To add or change a package dependency to get the package from OnePub run:

cd <my project>
onepub pub add [--dev] <package> [version]

Use the --dev switch to add the package as a dev dependency.

Pass the version if you want to control what version to pull, otherwise OnePub selects the latest compatible version. We recommend that in most cases you don't supply the [version].

If the package already exists as a dependency the onepub will simply update the hosted-url to point to OnePub.

OnePub