I still remember the first time I set up Dart on a new machine — I expected it to take five minutes, and it did, but only because I’d already made every possible mistake on my first attempt years earlier: wrong PATH configuration, a mismatched SDK version, and an IDE without the right plugins. In this guide, I’m walking through the complete process of setting up a professional Dart development environment, the way I’d explain it to someone sitting next to me, including the parts that trip people up and the workflow habits that separate a hobby setup from a productive, professional one.
Why Your Environment Setup Actually Matters
Before jumping into installation steps, I want to explain why this topic deserves a full article rather than a quick “download and install” note. Dart isn’t just a language you run through one interpreter — it has multiple compilation targets (native, JavaScript, WebAssembly), a dedicated package manager (pub), a build/analysis toolchain, and tight integration with Flutter. Getting the environment right the first time saves you from chasing confusing errors later that have nothing to do with your code and everything to do with a broken setup.
Step 1: Installing the Dart SDK
The Dart SDK includes the Dart VM, the dart command-line tool, the standard library, dartanalyzer/dart analyze, dartfmt/dart format, and the pub package manager — everything you need to write and run Dart code outside of Flutter.
On Windows
The most reliable method I recommend is using Chocolatey:
choco install dart-sdk
Alternatively, download the installer directly from the official Dart site and run it, which handles PATH configuration automatically.
On macOS
I personally use Homebrew, since it keeps updates simple:
brew tap dart-lang/dart
brew install dart
On Linux (Debian/Ubuntu-based)
sudo apt-get update
sudo apt-get install apt-transport-https
wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor -o /usr/share/keyrings/dart.gpg
echo 'deb [signed-by=/usr/share/keyrings/dart.gpg arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main' | sudo tee /etc/apt/sources.list.d/dart_stable.list
sudo apt-get update
sudo apt-get install dart
Verifying the Installation
Regardless of platform, confirm everything worked with:
dart --version
Expected output (version number will vary):
Dart SDK version: 3.5.0 (stable) (Tue Jun 4 12:00:00 2024 +0000) on "linux_x64"
If this command fails with “command not found,” the SDK’s bin directory isn’t on your system PATH — this is the single most common setup issue I’ve helped people fix. You need to manually add the Dart SDK’s bin folder to your PATH environment variable and restart your terminal.
Step 2: Choosing and Configuring an IDE
Dart works well in several editors, but I’ll focus on the two I actually recommend to people starting out, plus one alternative for those who want something lighter.
Visual Studio Code (My Personal Recommendation)
VS Code is free, fast, and has first-class Dart and Flutter support through official extensions.
- Download and install VS Code from the official site.
- Open the Extensions panel (
Ctrl+Shift+X/Cmd+Shift+X). - Search for and install the Dart extension (published by the Dart team).
- If you’re also building Flutter apps, install the Flutter extension too — it automatically pulls in the Dart extension as a dependency.
Once installed, VS Code auto-detects your Dart SDK location. You can verify by opening the Command Palette (Ctrl+Shift+P) and running Dart: Locate SDK.
Recommended settings.json additions for a smoother experience:
{
"editor.formatOnSave": true,
"dart.lineLength": 80,
"dart.previewFlutterUiGuides": true,
"editor.rulers": [80]
}
I keep formatOnSave on at all times — it means I never argue with a linter over formatting again, because dart format handles it automatically every time I save.
Android Studio / IntelliJ IDEA
If you’re already in the JetBrains ecosystem (especially if you’re building Flutter apps alongside native Android code), Android Studio is a strong choice.
- Install Android Studio.
- Go to Settings/Preferences → Plugins.
- Search for and install the Dart plugin, then the Flutter plugin if needed.
- Restart the IDE when prompted.
- Point the plugin to your Dart SDK path if it isn’t auto-detected (usually under
Languages & Frameworks → Dart).
The main advantage here is deeper integration with Android-specific tooling (emulators, Gradle, native debugging) if your work touches both Dart/Flutter and native Android code.
DartPad — Zero-Install Option
For quick experiments or teaching, I frequently use DartPad, a browser-based Dart editor with no installation at all. It’s not a replacement for a real project setup, but it’s genuinely useful for testing a snippet or showing someone a concept without asking them to install anything first.
Step 3: Creating Your First Project
Once the SDK is installed, creating a new console project is a single command:
dart create hello_dart
cd hello_dart
dart run
Expected output:
Hello world!
Let’s look at what dart create actually generated:
hello_dart/
├── analysis_options.yaml
├── bin/
│ └── hello_dart.dart
├── lib/
│ └── hello_dart.dart
├── test/
│ └── hello_dart_test.dart
├── pubspec.yaml
└── pubspec.lock
pubspec.yaml— the project manifest: name, dependencies, SDK version constraints.bin/— entry-point scripts (executables).lib/— your reusable library code.test/— unit tests, using thetestpackage by default.analysis_options.yaml— linter and static analysis configuration.
Understanding pubspec.yaml
name: hello_dart
description: A sample command-line application.
version: 1.0.0
environment:
sdk: '^3.5.0'
dependencies:
path: ^1.9.0
dev_dependencies:
lints: ^4.0.0
test: ^1.25.0
The environment.sdk constraint is important — it tells Dart (and anyone else running your project) exactly which SDK versions are compatible, preventing subtle version-mismatch bugs.
Step 4: The pub Package Manager
Dart’s package ecosystem lives at pub.dev, and the dart pub command handles installing, updating, and managing dependencies.
dart pub add http
dart pub get
dart pub upgrade
dart pub outdated
dart pub add httpadds the popularhttppackage topubspec.yamland fetches it.dart pub getresolves and downloads dependencies listed inpubspec.yaml.dart pub upgradeupdates dependencies to the latest versions allowed by your version constraints.dart pub outdatedshows which dependencies have newer versions available beyond your current constraints.
Here’s a quick example using the http package after adding it:
import 'package:http/http.dart' as http;
void main() async {
final response = await http.get(Uri.parse('https://jsonplaceholder.typicode.com/todos/1'));
print('Status code: ${response.statusCode}');
print(response.body);
}
Expected output (abbreviated):
Status code: 200
{
"userId": 1,
"id": 1,
"title": "delectus aut autem",
"completed": false
}
Step 5: Static Analysis and Linting
Dart ships with a built-in static analyzer that catches type errors, unused imports, and style issues before you even run your code.
dart analyze
Typical output when everything is clean:
Analyzing hello_dart...
No issues found!
The analysis_options.yaml file controls which lint rules apply. I always start new projects from the official lints or flutter_lints package presets rather than writing my own rule set from scratch:
include: package:lints/recommended.yaml
linter:
rules:
- prefer_const_constructors
- avoid_print
Step 6: Formatting Your Code
Dart’s formatter enforces a single, consistent style automatically — no debates about tabs vs. spaces or brace placement.
dart format .
I run this as part of my pre-commit routine (or better, let my editor do it automatically on save, as configured earlier). Consistent formatting matters more than people expect once you’re working on a team — it eliminates entire categories of noisy, meaningless diffs in code review.
Step 7: Setting Up Debugging
Command-Line Debugging
dart run --observe bin/hello_dart.dart
This starts your program with the Dart VM Service enabled, which you can connect to using Dart DevTools for live inspection, breakpoints, and performance profiling.
Installing and Launching DevTools
dart pub global activate devtools
dart devtools
This opens a browser-based suite of tools: a CPU profiler, memory inspector, network view, and — for Flutter apps — a widget inspector. I use DevTools constantly when chasing memory leaks or unexpected rebuild behavior in larger apps.
IDE-Based Debugging
Both VS Code and Android Studio support setting breakpoints directly in the editor gutter, stepping through code, and inspecting variables live — no separate DevTools window required for basic debugging sessions.
Step 8: Setting Up for Flutter Development (If Needed)
If your goal is Flutter development specifically, the setup extends a bit further:
git clone https://github.com/flutter/flutter.git -b stable
export PATH="$PATH:`pwd`/flutter/bin"
flutter doctor
flutter doctor is the single most useful command in the entire Flutter setup process — it audits your environment and tells you exactly what’s missing.
Sample output:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.0, on macOS 14.5)
[✓] Android toolchain - develop for Android devices
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] VS Code (version 1.91.0)
[✓] Connected device (3 available)
[✓] Network resources
• No issues found!
Any [✗] items indicate missing components — usually Android SDK licenses that need accepting (flutter doctor --android-licenses) or a missing Xcode command-line tools installation on macOS.
Configuring a Professional Workflow
Once the base setup is done, here’s the workflow I actually use day to day:
- Version control from the very first commit. I initialize git immediately (
git init) and add a.gitignore(Dart/Flutter projects generate one automatically) so build artifacts and.dart_tool/never get committed. - Editor auto-format and auto-organize-imports on save. This removes an entire category of manual cleanup work.
- Pre-commit hooks running
dart analyzeanddart format --set-exit-if-changed .to catch issues before they ever reach a pull request. - Consistent SDK version pinning across the team via the
environment.sdkconstraint inpubspec.yaml, to avoid “works on my machine” bugs caused by SDK drift. - DevTools open in a second monitor/tab during active debugging sessions, especially for anything involving performance or memory.
Common Setup Mistakes
- Forgetting to add the SDK to PATH, leading to “
dartis not recognized” errors in the terminal. - Mixing multiple Dart SDK installations (e.g., one from Homebrew and one bundled inside a Flutter SDK) without realizing which one is actually active —
which dart(macOS/Linux) orwhere dart(Windows) reveals this. - Ignoring
flutter doctorwarnings and then hitting confusing build failures much later that trace back to something flagged early on. - Not pinning SDK version constraints, causing a project to build fine on one machine and fail with type or syntax errors on another using an incompatible SDK version.
- Skipping
analysis_options.yamlcustomization, missing out on lint rules that catch real bugs (likeprefer_const_constructors, which has genuine performance implications in Flutter).
Troubleshooting Tips
- “dart: command not found” → Check your PATH; run
echo $PATH(macOS/Linux) or check Environment Variables (Windows) to confirm the SDK’sbinfolder is included. - Package version conflicts during
dart pub get→ Rundart pub depsto visualize the dependency tree and identify which packages have conflicting version constraints. - VS Code not recognizing Dart files → Confirm the Dart extension is installed and enabled, and restart the editor; occasionally a corrupted extension cache requires a full VS Code restart.
flutter doctorshows Android licenses not accepted → Runflutter doctor --android-licensesand accept each prompt.- Slow
dart pub get→ This is often a network/mirror issue; setting thePUB_HOSTED_URLenvironment variable to a regional mirror can help in some countries.
FAQs
Q: Do I need to install Flutter separately from Dart? No — the Flutter SDK bundles its own copy of the Dart SDK, so installing Flutter alone gives you everything needed for Flutter development. However, if you want to write standalone Dart command-line apps or packages without Flutter, installing the Dart SDK independently is cleaner and lighter weight.
Q: Which IDE is genuinely better, VS Code or Android Studio? Neither is objectively better — VS Code is lighter and faster to start, which I prefer for quick Dart scripting and most day-to-day Flutter work, while Android Studio/IntelliJ offers deeper native Android tooling integration if you regularly touch native Android code alongside Flutter.
Q: Can I develop Dart apps entirely in the browser without installing anything? Yes, via DartPad, though it’s limited to simple scripts and doesn’t support full project structures, local packages, or Flutter app development beyond basic widget previews.
Q: How do I update my Dart SDK version later? If installed via Homebrew or Chocolatey, running brew upgrade dart or choco upgrade dart-sdk handles it. If you’re using the Flutter-bundled SDK, running flutter upgrade updates both Flutter and its bundled Dart SDK together.
Q: What does dart pub get actually do differently from dart pub upgrade? dart pub get resolves dependencies to satisfy the constraints in pubspec.yaml, preferring versions already locked in pubspec.lock if they still satisfy those constraints. dart pub upgrade ignores the lock file’s existing versions and looks for the newest versions allowed by your constraints.
Summary
A solid Dart development environment isn’t just about getting dart --version to print something — it’s about setting up a workflow where the SDK, IDE, linter, formatter, and debugging tools all work together without friction. Getting this right up front, including proper PATH configuration, sensible lint rules, and a habit of running flutter doctor or dart analyze regularly, saves an enormous amount of time down the line and lets you focus on actual application logic instead of fighting your tools.
References
- Official Dart SDK installation guide: https://dart.dev/get-dart
- Official Dart Tools overview: https://dart.dev/tools
- Dart
pubpackage manager documentation: https://dart.dev/tools/pub/cmd - Flutter installation and
flutter doctordocumentation: https://docs.flutter.dev/get-started/install - Dart DevTools documentation: https://dart.dev/tools/dart-devtools