IDE Setup — VS Code & Android Studio
IDE Setup — VS Code & Android Studio
A great Integrated Development Environment (IDE) transforms coding from a chore into a pleasure. With the right setup, you get intelligent code completion, real-time error highlighting, integrated debugging, and one-click formatting. In this lesson, we'll configure VS Code and Android Studio for Dart development — plus introduce DartPad as a zero-installation alternative.
Option 1: VS Code (Recommended for Beginners)
Visual Studio Code is a lightweight, free, and highly extensible editor made by Microsoft. It's the most popular choice for Dart and Flutter developers.
Step 1 — Download and Install VS Code
- Go to https://code.visualstudio.com
- Download the installer for your OS (Windows / macOS / Linux)
- Run the installer and follow the prompts
- Launch VS Code when done
Step 2 — Install the Dart Extension
The Dart extension is the heart of your Dart development setup in VS Code.
- Open VS Code
- Press
Ctrl+Shift+X(Windows/Linux) orCmd+Shift+X(macOS) to open Extensions - Search for "Dart"
- Click Install on the extension by Dart Code (publisher: dart-code)
What the Dart extension gives you:
- Syntax highlighting
- IntelliSense (code completion)
- Real-time error and warning indicators
- Go to Definition / Find References
- Integrated Dart DevTools
- Debugging support
- Code formatting via
dart format
Step 3 — Install the Flutter Extension (Optional but Recommended)
Even if you're learning Dart before Flutter, the Flutter extension adds extra tooling that works well with Dart.
- In Extensions, search for "Flutter"
- Click Install on the extension by Dart Code
Tip: Installing Flutter extension also ensures the Dart extension is at its latest supported version.
Step 4 — Configure settings.json for Dart
VS Code's settings can be customized per-project or globally. Let's set up ideal Dart defaults.
Open the Command Palette with Ctrl+Shift+P (or Cmd+Shift+P), type "Open User Settings (JSON)", and add:
json{ // Dart-specific settings "[dart]": { "editor.formatOnSave": true, "editor.formatOnType": true, "editor.rulers": [80], "editor.selectionHighlight": false, "editor.suggest.snippetsPreventQuickSuggestions": false, "editor.suggestSelection": "first", "editor.tabCompletion": "onlySnippets", "editor.wordBasedSuggestions": "off" }, // Dart SDK path (only needed if not auto-detected) // "dart.sdkPath": "C:/dart-sdk", // Show type annotations inline "dart.inlayHints": true, // Line length for dart format "dart.lineLength": 80, // Enable closing labels for widgets/constructors "dart.closingLabels": true, // Preview flutter outline in sidebar "dart.flutterOutline": true }
Essential VS Code Keyboard Shortcuts for Dart
| Action | Windows/Linux | macOS |
|---|---|---|
| Format document | Shift+Alt+F | Shift+Option+F |
| Go to definition | F12 | F12 |
| Find all references | Shift+F12 | Shift+F12 |
| Rename symbol | F2 | F2 |
| Quick fix / code actions | Ctrl+. | Cmd+. |
| Toggle terminal | Ctrl+` | Ctrl+` |
| Command Palette | Ctrl+Shift+P | Cmd+Shift+P |
| Run without debug | Ctrl+F5 | Cmd+F5 |
| Start debugging | F5 | F5 |
Step 5 — Verify VS Code Setup
Create a file called hello.dart and type:
dartvoid main() { print('VS Code Dart setup is working!'); }
You should see:
- Syntax highlighting (colorful code)
- No red underlines (no errors)
Press F5 or open the terminal and run:
bashdart run hello.dart
Option 2: Android Studio / IntelliJ IDEA
Android Studio (built on IntelliJ IDEA) is a full-featured IDE, especially powerful for Flutter and Android projects. If you plan to build mobile apps, this is a great choice.
Step 1 — Download Android Studio
- Go to https://developer.android.com/studio
- Download and install Android Studio for your OS
- Complete the initial setup wizard (you can skip Android SDK install for now if you're Dart-only)
Step 2 — Install the Dart Plugin
- Open Android Studio
- Go to File → Settings (Windows/Linux) or Android Studio → Preferences (macOS)
- Navigate to Plugins
- Search for "Dart"
- Click Install and restart Android Studio
Step 3 — Install the Flutter Plugin (Optional)
- In the same Plugins screen, search for "Flutter"
- Click Install
- Restart Android Studio
Note: The Flutter plugin automatically enables the Dart plugin as a dependency.
Step 4 — Configure Dart SDK in Android Studio
After installing the plugin:
- Go to File → Settings → Languages & Frameworks → Dart
- Check Enable Dart support for the project
- Set the Dart SDK path (e.g.,
C:\dart-sdkon Windows,/usr/lib/darton Linux) - Click Apply → OK
Android Studio Features for Dart
| Feature | Description |
|---|---|
| Smart completion | Context-aware suggestions as you type |
| Parameter hints | Shows parameter names inline |
| Refactoring tools | Rename, extract method, introduce variable |
| Integrated debugger | Breakpoints, watch expressions, call stack |
| Dart Analysis | Real-time error and lint checking |
| Code formatting | Ctrl+Alt+L applies dart format |
| Structure view | See all classes/methods in sidebar |
Essential Android Studio Shortcuts
| Action | Windows/Linux | macOS |
|---|---|---|
| Format code | Ctrl+Alt+L | Cmd+Option+L |
| Go to definition | Ctrl+B | Cmd+B |
| Find usages | Alt+F7 | Option+F7 |
| Rename | Shift+F6 | Shift+F6 |
| Quick fix | Alt+Enter | Option+Enter |
| Run | Shift+F10 | Ctrl+R |
| Debug | Shift+F9 | Ctrl+D |
Option 3: DartPad — No Installation Required
DartPad is an official online Dart editor from the Dart team. It runs entirely in your browser — no installation needed.
🌐 URL: https://dartpad.dev
What DartPad Offers
- Run Dart code instantly in the browser
- Test Flutter widgets with the Flutter toggle
- Share code via URL with colleagues
- Access built-in samples and tutorials
- See console output, errors, and documentation
Limitations of DartPad
| Limitation | Details |
|---|---|
| No file system access | Can't read/write files |
| No package imports | Only core Dart + some approved packages |
| Single file only | Can't manage multi-file projects |
| Requires internet | No offline use |
| Performance | Slightly slower than native |
When to Use DartPad
- Quickly testing a Dart snippet
- Sharing code examples with others
- Learning Dart without any setup
- Experimenting with concepts
Recommended Extensions & Plugins Summary
VS Code Extensions
| Extension | Purpose | Install |
|---|---|---|
| Dart | Core Dart support | Required |
| Flutter | Flutter + enhanced Dart | Highly recommended |
| Error Lens | Inline error messages | Optional |
| Bracket Pair Colorizer | Color-matched brackets | Optional |
| GitLens | Git history in editor | Optional |
| Pubspec Assist | Easy package.yaml management | Optional |
Android Studio / IntelliJ Plugins
| Plugin | Purpose |
|---|---|
| Dart | Core Dart language support |
| Flutter | Flutter framework integration |
| Rainbow Brackets | Color-coded bracket pairs |
| String Manipulation | Handy string tools |
Summary
In this lesson, you set up your Dart development environment with:
- VS Code — Dart extension, Flutter extension,
settings.jsonfor format-on-save and line length, keyboard shortcuts - Android Studio — Dart plugin, Flutter plugin, SDK path configuration, and power-user shortcuts
- DartPad — The zero-setup browser-based Dart editor for quick experiments
Recommendation: If you're just starting with Dart, use VS Code — it's lightweight, fast, and has excellent Dart support. If you're heading toward Flutter mobile development, Android Studio is worth learning eventually.
Next Up: Let's explore DartPad and the Dart CLI in detail and run your very first Dart program.