Skip to main content

Overview

Before you can start writing Dart code, you need to set up your development environment. This guide will walk you through installing the Dart SDK and choosing an editor for writing your programs.
The setup process typically takes 10-15 minutes. Once complete, you’ll be able to run all the examples in this course on your own computer.

Installing the Dart SDK

The Dart SDK includes everything you need to run Dart programs: the Dart VM, core libraries, and command-line tools.
If you have Chocolatey installed:
choco install dart-sdk

Manual Installation

1

Download the SDK

Visit the Dart SDK download page and download the Windows installer.
2

Run the installer

Execute the downloaded .exe file and follow the installation wizard.
3

Add to PATH

The installer should automatically add Dart to your PATH. If not, add the Dart SDK bin directory manually:
C:\tools\dart-sdk\bin

Verify Installation

After installing the Dart SDK, verify that it’s working correctly:
1

Open a terminal

Open a new terminal or command prompt window (this ensures PATH changes are loaded).
2

Check Dart version

Run the following command:
dart --version
You should see output similar to:
Dart SDK version: 3.2.0 (stable)
If you see “command not found” or “‘dart’ is not recognized”, the Dart SDK is not in your PATH. Revisit the installation steps and ensure the bin directory is correctly added to your PATH environment variable.

Choose Your Editor

You can write Dart code in any text editor, but these editors provide the best experience with syntax highlighting, code completion, and debugging:

VS Code

Free, lightweight, and powerful editor with excellent Dart support
Setup VS Code for Dart:
1

Install VS Code

Download and install Visual Studio Code.
2

Install Dart extension

  1. Open VS Code
  2. Click the Extensions icon in the sidebar (or press Ctrl+Shift+X / Cmd+Shift+X)
  3. Search for “Dart”
  4. Click Install on the official Dart extension by Dart Code
3

Verify setup

Create a new file called test.dart and start typing. You should see syntax highlighting and code suggestions.
VS Code Tips:
  • Use F5 to run your Dart programs with debugging
  • Type main and press Tab for a code snippet
  • Hover over any Dart function to see its documentation

IntelliJ IDEA / Android Studio

IntelliJ IDEA

Professional IDE with powerful refactoring and debugging tools
Setup IntelliJ/Android Studio:
1

Install IDE

Download and install IntelliJ IDEA (Community Edition is free) or Android Studio.
2

Install Dart plugin

  1. Open IntelliJ/Android Studio
  2. Go to Settings/PreferencesPlugins
  3. Search for “Dart”
  4. Click Install
3

Configure Dart SDK

  1. Go to Settings/PreferencesLanguages & FrameworksDart
  2. Check Enable Dart support
  3. Set the Dart SDK path (e.g., C:\tools\dart-sdk or /usr/lib/dart)

Other Editors

Dart also works with:
  • Sublime Text - Install the Dart syntax package
  • Vim/Neovim - Use the dart-vim-plugin
  • Emacs - Use dart-mode
  • Any text editor - Just save files with .dart extension

Create Your First Program

Let’s verify everything is working by creating and running your first Dart program:
1

Create a project directory

mkdir dart-course
cd dart-course
2

Create a Dart file

Create a new file called hello.dart with the following content:
void main() {
  print('Hola!!!');
}
3

Run the program

Execute your program using the Dart command:
dart hello.dart
You should see:
Hola!!!
Congratulations! You’ve successfully set up your Dart development environment and run your first program.

Understanding the Dart Command

The dart command is your main tool for working with Dart programs:
# Run a Dart program
dart filename.dart

# Run a Dart program with arguments
dart filename.dart arg1 arg2

# Format Dart code (makes it pretty)
dart format filename.dart

# Analyze code for issues
dart analyze

# Compile to executable
dart compile exe filename.dart
Pro Tip: Use dart format regularly to keep your code consistently formatted. This is especially helpful when working on team projects.

Troubleshooting Common Issues

Problem: The terminal doesn’t recognize the dart command.Solution:
  1. Ensure you’ve installed the Dart SDK correctly
  2. Verify the Dart SDK bin directory is in your PATH
  3. Close and reopen your terminal to reload environment variables
  4. Try running with the full path: /path/to/dart-sdk/bin/dart
Problem: Cannot execute Dart programs due to permission errors.Solution: Make the Dart executable accessible:
chmod +x /path/to/dart-sdk/bin/dart
Problem: No syntax highlighting or code completion in your editor.Solution:
  1. Ensure you’ve installed the Dart extension/plugin for your editor
  2. Verify the file has a .dart extension
  3. Restart your editor after installing extensions
  4. Check that the Dart SDK path is configured correctly in editor settings
Problem: Dart programs execute but show warnings or errors.Solution: Run dart analyze to see detailed error messages:
dart analyze filename.dart
This will show you exactly what’s wrong and where.

Development Workflow

Now that your environment is set up, here’s the typical workflow you’ll use:
1

Write code

Create or edit .dart files in your chosen editor.
2

Save frequently

Save your work often (most editors auto-save).
3

Run your program

Execute with dart filename.dart in the terminal.
4

Check for errors

Read any error messages carefully - they tell you exactly what’s wrong.
5

Iterate

Fix errors, add features, and re-run until your program works as expected.

Next Steps

Your development environment is ready! Now you can start learning Dart:

Hello World

Write your first Dart program and understand its structure

Variables

Learn how to store and work with data in Dart
Ready to Code? Keep your terminal and editor side-by-side. Write code in the editor, run it in the terminal, and see results immediately. This fast feedback loop is key to learning effectively!

Build docs developers (and LLMs) love