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.- Windows
- macOS
- Linux
Using Chocolatey (Recommended)
If you have Chocolatey installed:Manual Installation
Download the SDK
Visit the Dart SDK download page and download the Windows installer.
Verify Installation
After installing the Dart SDK, verify that it’s working correctly:Open a terminal
Open a new terminal or command prompt window (this ensures PATH changes are loaded).
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:Visual Studio Code (Recommended)
VS Code
Free, lightweight, and powerful editor with excellent Dart support
Install VS Code
Download and install Visual Studio Code.
Install Dart extension
- Open VS Code
- Click the Extensions icon in the sidebar (or press
Ctrl+Shift+X/Cmd+Shift+X) - Search for “Dart”
- Click Install on the official Dart extension by Dart Code
IntelliJ IDEA / Android Studio
IntelliJ IDEA
Professional IDE with powerful refactoring and debugging tools
Install IDE
Download and install IntelliJ IDEA (Community Edition is free) or Android Studio.
Install Dart plugin
- Open IntelliJ/Android Studio
- Go to Settings/Preferences → Plugins
- Search for “Dart”
- Click Install
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
.dartextension
Create Your First Program
Let’s verify everything is working by creating and running your first Dart program:Congratulations! You’ve successfully set up your Dart development environment and run your first program.
Understanding the Dart Command
Thedart command is your main tool for working with Dart programs:
Troubleshooting Common Issues
'dart' command not found
'dart' command not found
Problem: The terminal doesn’t recognize the
dart command.Solution:- Ensure you’ve installed the Dart SDK correctly
- Verify the Dart SDK
bindirectory is in your PATH - Close and reopen your terminal to reload environment variables
- Try running with the full path:
/path/to/dart-sdk/bin/dart
Permission denied on Linux/macOS
Permission denied on Linux/macOS
Problem: Cannot execute Dart programs due to permission errors.Solution:
Make the Dart executable accessible:
Editor doesn't recognize Dart syntax
Editor doesn't recognize Dart syntax
Problem: No syntax highlighting or code completion in your editor.Solution:
- Ensure you’ve installed the Dart extension/plugin for your editor
- Verify the file has a
.dartextension - Restart your editor after installing extensions
- Check that the Dart SDK path is configured correctly in editor settings
Programs run but show errors
Programs run but show errors
Problem: Dart programs execute but show warnings or errors.Solution:
Run This will show you exactly what’s wrong and where.
dart analyze to see detailed error messages:Development Workflow
Now that your environment is set up, here’s the typical workflow you’ll use: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