Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Data Types
  • Functions
  • Oops
  • Collections
  • Sets
  • Dart Interview Questions
  • Fluter
  • Android
  • Kotlin
  • Kotlin Android
  • Android with Java
  • Android Studio
Open In App
Next Article:
How to Install and Setup Visual Studio for ASP.NET?
Next article icon

Dart - Installation and Setup in Visual Studio Code

Last Updated : 30 Sep, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

If you want to start developing with Dart, one of the easiest ways is to install Dart in Visual Studio Code. VS Code offers a lightweight, user-friendly environment that integrates well with Dart programming. In this guide, we’ll walk you through installing Dart in VS Code and configuring the necessary tools for Dart development. With the right setup, you'll be able to write, debug, and run Dart code seamlessly within Visual Studio Code.

Table of Content

  • Dart SDK
    • Installation:
    • Setup:
  • Visual Studio Code
    • Installation:

Dart SDK

Installation

Follow the below steps to install the Dart SDK:

Step 1: Open the “Get the Dart SDK” website.

Step 2: Scroll down to the bottom of the website and click “Downloading the SDK as a zip file”.

Step 3: Based on your device’s architecture, Click the “Dark SDK” for Windows Mac, or Linux, accordingly.

Step 4: Once the download is complete, go to the “Downloads” folder and unzip the newly downloaded Dart-SDK zip file.

Step 5: For unzipping the file, right-click on the file and click “Extract Here”.

Step 6: Now, a new “dart-sdk” folder will be created in the “Downloads” folder.

Step 7: Copy this file and paste it into the “Program Files” folder in the “C” drive.

Step 8: Open the “dart-sdk” folder and you will find a folder named “bin”.

Step 9: Now, right-click on the “bin” folder and choose “Properties”.

Step 10: In the “bin Properties” window, go to “Security” and copy the “Object Name”, also known as the address of the file, and press “Ok”.

Installation of Dart SDK

Setup

Step 11: Open the “This PC” folder, right-click inside this folder, and choose “Properties”.  

Step 12: In the “System” window, select “Advanced system settings” that will be available on the left-hand side of the window.  

Step 13: In the “Advanced” tab, press the “Environment Variables…” button.

Step 14: In the “Environment Variables” window, under “User Variables for...” check for the “Path” variable.

Step 15: If it’s available, then press the “Edit” button, press the “New” button in the “Edit environment variable” window, add the copied address to it, and save the made changes.

Step 16: If it’s unavailable, then create one by pressing the “New” button and entering the “Variable Name” as “Path” and “Variable Value” as the copied address, and press “Ok”.  

Setting Environment variables for Dart SDK

Step 17: Now open the Command Prompt (cmd) and type "dart".

Step 18: The output will be as follows.

Dart
  ╔════════════════════════════════════════════════════════════════════════════╗   ║ The Dart tool uses Google Analytics to anonymously report feature usage    ║   ║ statistics and to send basic crash reports. This data is used to help      ║   ║ improve the Dart platform and tools over time.                             ║   ║                                                                            ║   ║ To disable reporting of anonymous analytics, run:                          ║   ║                                                                            ║   ║   dart --disable-analytics                                                 ║   ║                                                                            ║   ╚════════════════════════════════════════════════════════════════════════════╝  A command-line utility for Dart development.  Usage: dart [<vm-flags>] <command|dart-file> [<arguments>]  Global options: -h, --help                 Print this usage information. -v, --verbose              Show additional command output.     --version              Print the Dart SDK version.     --enable-analytics     Enable anonymous analytics.     --disable-analytics    Disable anonymous analytics.  Available commands:   analyze   Analyze the project's Dart code.   compile   Compile Dart to various formats.   create    Create a new project.   fix       Apply automated fixes to Dart source code.   format    Idiomatically format Dart source code.   migrate   Perform a null safety migration on a project or package.   pub       Work with packages.   run       Run a Dart program.   test      Run tests in this package.  Run "dart help <command>" for more information about a command. See https://dart.dev/tools/dart-tool for detailed documentation. 

Step 19: If your output is just like above then, it signifies that the dart has been installed successfully.

Visual Studio Code

Installation

Follow the below steps to set up Dart in VS Code:

Step 1: Open Visual Studio Code on your device. 

Note: If unavailable then, open “Download Visual Studio Code” and download
the application based on your device’s architecture and configurations.

Step 2: Press “Ctrl + B” and select “Extensions” or directly Press “Ctrl + Shift + X”.

Step 3: In the search bar, type “Dart” and open the first extension named “Dart” by “Dart Code” in the list. Press the “Install” button.

Installing Dart in Visual Studio Code

Step 4: Once the installation is complete, click “File” and “New File”.

Step 5: Again click “File”, and “Save As” and name the file with a “.dart” extension like “gig. dart”. This file should be saved under a folder, but not as a loose file. So, if needed create a new folder named “Dart” and save this new file under this folder.

Now, let’s code our first Dart program.

Dart
void main() {   print("Welcome to GeeksforGeeks!"); } 

Step 6: The above code helps us print the string “Welcome to GeeksforGeeks!”. Type or copy the above code in the coding area.

Step 7: Save the file by pressing “Ctrl + S” or by selecting “File” and “Save”.

Step 8: Now for running the code, press “Ctrl + Shift + D” and press the “Run and Debug” button or open “Run” and select “Start Debugging”.

Step 9: Now a new file named “launch.json” will be created and it opens automatically in VS Code.

Dart
{     // Use IntelliSense to learn about possible attributes.     // Hover to view descriptions of existing attributes.     // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387     "version": "0.2.0",     "configurations": [         {             "name": "Dart & Flutter",             "request": "launch",             "type": "dart",             "program" : "gfg.dart"         }     ] } 

Step 10: In the “launch.json” file, add "program value" inside the curly brackets ({}), like for example {“program”: “gfg. Dart”} as shown above, and save the file.

Note: If needed add a “,” (comma), to the previous value of "program" in the code of “launch.json” file.

Step 11: Now, press “Run” and then click "Run without Debugging”. The output of the dart file will be displayed in the "Debug Console".

Dart
Welcome to GeeksforGeeks! Exited 

Step 12: Now to run the code in a terminal, press "Terminal" and click "New terminal".

Step 13: Now in the terminal, type “dart file_name” like "dart gig. dart" and press "Enter".

Step 14: The output of the file will be displayed in the terminal.

Dart
PS C:\Users\name\Dart> dart gfg.dart Welcome to GeeksforGeeks! 

Output

Conclusion

By following these steps, you’ve completed the Dart setup in VS Code. With the Dart extension for Visual Studio Code, you now have a fully functional environment for Dart programming. Whether you are building mobile apps or backend solutions, Dart development in Visual Studio Code makes your workflow smooth and efficient. Don’t forget to explore additional Dart tools set in Visual Studio Code to further enhance your coding experience.


Next Article
How to Install and Setup Visual Studio for ASP.NET?
author
varshaadhanasekar
Improve
Article Tags :
  • TechTips
  • Dart
  • how-to-install

Similar Reads

  • How to Install and Setup Visual Studio for C#?
    Installing and setting up Visual Studio is the first step for developers to build, compile, and run C# applications. Whether you are a beginner or an experienced programmer, Visual Studio provides a powerful integrated development environment (IDE) for writing and debugging C# code. With Visual Stud
    3 min read
  • How to Install and Setup Visual Studio for ASP.NET?
    Visual Studio is an Integrated Development Environment(IDE) developed by Microsoft to develop GUI(Graphical User Interface), Web applications, console, web apps, mobile apps, cloud, and web services, etc. To install and use Visual Studio for the commercial purpose one must buy a license from Microso
    4 min read
  • How to Install and Setup Live Server Extensions on Visual Studio code?
    Visual Studio Code is one of the most sought-after IDE (Integrated Development Interface) of the current time. It helps the developers to efficiently write, build and test software over a single platform by combining and providing a multilateral set of functions. Visual Studio Code supports various
    3 min read
  • How to Download and Install Visual Studio Code on Ubuntu?
    Visual Studio Code is a code editor that is basically used for web development or cloud platforms, but nowadays Visual Studio Code can do a lot. It is stated as the second most used code editor by developers in 2022 so if you are an aspiring IT student or a developer you should know how to use Visua
    1 min read
  • How to Install Flutter on Visual Studio Code?
    In this article, we will walk through the process of installing Flutter in Visual Studio Code. Flutter is an open-source portable UI framework for mobile, desktop, and web. It is developed and managed by Google, Flutter is used for creating a high-quality, beautiful, and fast native interface for an
    4 min read
  • How to Install and Use Packages in Visual Studio for MacOS?
    In this article, we will learn how to install and use a package in Visual Studio for MacOS. Visual Studio is an Integrated Development Environment(IDE) developed by Microsoft to develop GUI(Graphical User Interface), console, Web applications, web apps, mobile apps, cloud, web services, etc. Native
    2 min read
  • How to Install Visual C++ in MacOS?
    Visual C++ is Software made by Microsoft Corporation. It is used to build desktop applications using the C and C++ languages. It was initially released in February 1993. In this article, we are going to learn how we can install Visual C++ in our Mac operating system. Installing Visual C++on MacOS: F
    1 min read
  • How to Install a C# Class Library in Visual Studio?
    A C# library project is a separate project used to hold utility classes. So this might be the class that handles our database or might handle some communications with the network. In our case, we are going to create a math library that is a stand-in for some of those other cases. It is a single sour
    3 min read
  • How to Install Visual Studio Code on Windows?
    Visual Studio Code (VS Code) is a free, lightweight, and open-source code editor developed by Microsoft. It supports multiple operating systems, including Windows, macOS, and Linux. VS Code is designed to be versatile and user-friendly, offering features such as: Syntax Highlighting and Autocompleti
    3 min read
  • How to Install Kotlin on MacOS using Visual Studio Code?
    Kotlin is a modern statically typed and open source programming language that features both object-oriented and functional programming constructs. Over 60% of professional Android developers use Kotlin that helps boost productivity, developer satisfaction, and code safety. Features of Kotlin: Kotlin
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences