Install VS Code
Visual Studio Code (VS Code) is the recommended editor for Dart development. Download it from code.visualstudio.com and install it for your operating system.
Install Dart Extension
After opening VS Code:
- Press
Ctrl+Shift+X (or Cmd+Shift+X on Mac) to open Extensions.
- Search for Dart.
- Install the Dart extension by Dart Code.
- Optionally install the Flutter extension if you plan to use Flutter.
The Dart extension provides:
- Syntax highlighting
- Code completion (IntelliSense)
- Debugging support
- Code formatting
- Quick fixes and refactoring
Create a Dart Project
Open VS Code terminal (Ctrl+`) and run:
dart create my_first_app
cd my_first_app
This creates a Dart project with the following structure:
my_first_app/
├── bin/
│ └── my_first_app.dart ← entry point
├── lib/
│ └── my_first_app.dart ← library code
├── test/
│ └── my_first_app_test.dart
└── pubspec.yaml ← project config
Run Your First Program
Open bin/my_first_app.dart and you'll see:
void main() {
print('Hello, World!');
}
Run it from the terminal:
dart run
You can also press F5 in VS Code to launch the debugger.
Useful Extensions
| Extension | Purpose |
| Dart | Core Dart language support |
| Flutter | Flutter framework support |
| Pubspec Assist | Easily add pub.dev packages |
| Error Lens | Inline error messages |
| Bracket Pair Colorizer | Color-coded brackets |
📝 Tip: Enable format-on-save in VS Code settings (editor.formatOnSave: true) so your Dart code is automatically formatted using dart format every time you save.
🧠 Quiz
1. Which extension provides Dart support in VS Code?
- A) Dart Code ✅
- B) Dart Plus
- C) DartIDE
- D) Dart Studio
2. What command creates a new Dart project?
- A) dart init
- B) dart new
- C) dart create ✅
- D) dart start
Summary
Set up Dart development in VS Code by installing the Dart extension, creating a project with dart create, and running it with dart run or F5. Enable format-on-save for clean code automatically.