Visual Studio Code
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
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.
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.
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
Last modified 1yr ago