×
×

Spread the love

In this tutorial you will learn how to install flutter with visual studio code in windows, mac & ubuntu.This tutorial mainly focuses on how to configure visual studio code with flutter.For installing flutter on windows, mac and Ubuntu just refer below links.

Windows : How to install flutter on windows with android studio.
Mac : How to install flutter on mac with Xcode.
Ubuntu : How to install flutter on ubuntu.

Note: The content of this post is completely referenced from official websites of flutter and visual studio code.

Installing Visual Studio Code

Windows

  • Download Visual Studio Code.
  • Once it is downloaded, run the installer (VSCodeUserSetup-{version}.exe). This will only take a minute.

Mac

Method 1

Installing visual studio code on mac is quite a simple task as this requires just one command to download and install.

To install visual studio code on mac just run the following command

$ brew cask install visual-studio-code

Method 2

You can also install visual studio code the other way suggested in official documentation.lets see it below.

  • Download Visual studio code for mac.
  • Double-click on the downloaded archive to expand the contents.
  • Drag Visual Studio Code.app to the Applications folder, making it available in the Launchpad.
  • Add VS Code to your Dock by right-clicking on the icon to bring up the context menu and choosing Options, Keep in Dock.

Launching visual studio code from command line

You can also run VS Code from the terminal by typing ‘code’ after adding it to the path.

  • Launch VS Code.
  • Open the Command Palette (F1) and type ‘shell command’ to find the Shell Command: Install ‘code’ command in PATH command.
  • Restart the terminal for the new $PATH value to take effect. You’ll be able to type ‘code .’ in any folder to start editing files in that folder.

Note: If you still have the old code alias in your .bash_profile (or equivalent) from an early VS Code version, remove it and replace it by executing the Shell Command: Install ‘code’ command in PATH command.

To manually add VS Code to your path, you can run the following commands

cat << EOF >> ~/.bash_profile
# Add Visual Studio Code (code)
export PATH="\$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"
EOF

Start a new terminal to pick up your .bash_profile changes.

Note: The leading slash \ is required to prevent $PATH from expanding during the concatenation. Remove the leading slash if you want to run the export command directly in a terminal.

Ubuntu

Method 1

  • To install visual studio code on Ubuntu download the 64 bit .deb file from the Visual Studio Download Page.
  • Save the file on prompt and wait for the file to download.
  • Once the file is downloaded go to downloads folder by using the following command.
$ cd ~/Downloads
  • Now to install visual studio code run the following command.
sudo dpkg -i your file name.deb
  • Replace your file name.deb in the above command with the name of the .deb package you downloaded

After replacing the above command will look like

sudo dpkg -i code_1.41.1-1576681836_amd64.deb 

That would install visual studio code successfully.

Method 2

We can also install visual studio code as per official documentation.Lets see the steps below.

The easiest way to install Visual Studio Code for Debian/Ubuntu based distributions is to download and install the .deb package (64-bit), either through the graphical software center if it’s available, or through the command line with

sudo apt install ./<file>.deb

# If you're on an older Linux distribution, you will need to run this instead:
# sudo dpkg -i <file>.deb
# sudo apt-get install -f # Install dependencies

Installing the .deb package will automatically install the apt repository and signing key to enable auto-updating using the system’s package manager. Note that 32-bit and .tar.gz binaries are also available on the VS Code download page.

The repository and key can also be installed manually with the following script.

curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -o root -g root -m 644 packages.microsoft.gpg /usr/share/keyrings/
sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'

Then update the package cache and install the package using

sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install code # or code-insiders

Install Flutter Extension on Visual Studio Code

  • Launch Visual Studio code.
  • Click on Extensions located in the left menu.
  • Type flutter in the search bar.
  • Find the flutter extension by dartcode.
  • Click on install button
  • Restart Visual Studio Code after installing the extension.

And you are done!!

That’s all about how to install flutter with visual studio code in windows, mac and Ubuntu.We will discuss other flutter concepts in next posts.

Do like and share if you find the post helpful.Thank you!!


Spread the love

AUTHOR

Naresh Pradeep

Hey there! I am the founder of CodesInsider and android developer.I love to code and build apps.


Related Posts

Leave a Reply

Your email address will not be published.