Installing Dart on Ubuntu 20.x

Details to install Dart on Ubuntu are listed on get-dart. I’m recreating here solely for my own reference.

sudo apt-get update
sudo apt-get install apt-transport-https
wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor -o /usr/share/keyrings/dart.gpg
echo 'deb [signed-by=/usr/share/keyrings/dart.gpg arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main' | sudo tee /etc/apt/sources.list.d/dart_stable.list

Next install the Dart DSK

sudo apt-get update
sudo apt-get install dart

Export the path

export PATH="$PATH:/usr/lib/dart/bin"

Then add the PATH to your ~/.profile or ~/.bashrc, for example

echo 'export PATH="$PATH:/usr/lib/dart/bin"' >> ~/.profile

Now let’s see if it all worked, run

dart --version

If all went well you’ll see something like Dart SDK version: 2.16.1 (stable) (Unknown timestamp) on “linux_x64”.