Setting Up Dart
Installing the Dart SDK and understanding the tools — dart run, dart compile, and dart format — you'll use throughout this course.
2 min de lectura
Before writing any Dart, you need the Dart SDK — the compiler, package manager, and command-line tools bundled together. It's free and available for Windows, macOS, and Linux.
Installing the SDK
The easiest path on most systems is a package manager:
# macOS (Homebrew)
brew tap dart-lang/dart
brew install dart
# Windows (Chocolatey)
choco install dart-sdk
# Linux (apt, Debian/Ubuntu-based)
sudo apt-get install dartIf you plan on building Flutter apps later, installing the Flutter SDK gives you a bundled copy of Dart too — but for this course, the standalone Dart SDK is all you need. Once installed, confirm it worked:
dart --versionThe dart command
Everything you'll do from the terminal goes through a single dart executable with subcommands:
dart create my_app # scaffold a new project
dart run # run the project's main entrypoint
dart run bin/my_app.dart # run a specific file
dart compile exe app.dart -o app # compile to a standalone native executable
dart format . # auto-format all Dart files in the project
dart analyze # static analysis — catches type errors, unused code, style issuesdart analyze is worth running often. Because Dart is statically typed, the analyzer catches an entire category of mistakes — wrong argument types, typos in member names, unreachable code — before you ever run the program.
Editor support
Dart works in any text editor, but VS Code and IntelliJ/Android Studio both have official Dart extensions that add inline type errors, autocomplete, and formatting on save. If you're using VS Code, install the Dart extension from the marketplace — it doesn't require Flutter to be useful.
Project structure, briefly
A typical Dart project (created via dart create) looks like this:
my_app/
bin/
my_app.dart # entrypoint with main()
lib/
my_app.dart # reusable library code
test/
my_app_test.dart
pubspec.yaml # project metadata and dependencies
pubspec.yaml is Dart's equivalent of package.json — it declares your project's name, SDK version constraints, and any packages pulled from pub.dev, Dart's package repository. You won't need external packages for this course, but it's worth knowing that name once you start building real projects.
With the SDK installed and dart --version printing a version number, you're ready to write your first program.