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
  • Docker containers
  • Install onepub into docker

Was this helpful?

  1. Guides
  2. Installing
  3. IDE integration

Visual Studio Code

PreviousAndroid StudioNextPre Dart 2.15

Last updated 2 years ago

Was this helpful?

Providing that you are using at least dart 2.15 then OnePub works with Visual Studio Code out of the box.

The only actions required are to install OnePub and then login:

flutter pub global activate onepub
onepub login

If you are running a Dart version pre 2.12 then follow the install instructions.

Docker containers

VS Code provides the ability to do your debugging in a local docker container via the command:

Remote-Containers: Open Folder in Container...

As you are operating in a docker container the onepub login command will not work.

Instead you need to use one of the alternate methods documented in our section.

The easiest of these methods is to add mounts to your .devcontainer/devcontainer.json file in your vscode project.

Here are the two mounts you need to add.

"mounts": [
	"source=${localEnv:HOME}/.config/dart/pub-tokens.json,target=${containerEnv:HOME}/.config/dart/pub-tokens.json,type=bind,consistency=cached",
	"source=${localEnv:HOME}/.onepub/onepub.yaml,target=${containerEnv:HOME}/.onepub/onepub.yaml,type=bind,consistency=cached"
]

Once mounted you can login OnePub in your host environment and your docker container will also be logged into OnePub.

Install onepub into docker

You will also want to install onepub into the Docker container.

To do this edit the the .devcontainer/Dockerfile and add the following command to the end of the file:

RUN dart pub global activate onepub

pre 2.12
Docker