dartdart-editordart-pub

How do you access the command line in Dart Pub package manager


I am trying to explore using Dart's Pub package manager on the command line. Unfortunately, I don't know how to do this, and all the documentation I have read, presupposes that this is known. What are the actual steps needed to set up the command line, so you can run pub commands on GNU/Linux systems?

This is an expansion on this question: link. Can someone please help?


Solution

  • If you're on Linux and you've unpackaged the SDK in /home/$USER/ you should add the SDK PATH to the bottom of your .bashrc.

    vim ~/.bashrc

     DART_SDK=/home/${USER}/dart/dart-sdk
     export PATH=${PATH}:${DART_SDK}/bin
     alias DartEditor='/home/${USER}/dart/DartEditor'
     alias dartium='/home/${USER}/dart/chromium/chrome'
    

    You might have to run source ~/.bashrc to have the binaries available in your current console.

    Now you should be able to run pub --help and work your way from there. Also you can now open the editor and the dart based chrome from the commandline like this: DartEditor or dartium (add & exit to those command if you don't want the output from those programs).

    Good luck!