Dart Get Started
Get Started with Dart
You can try Dart in your browser with our "Try it Yourself" editor.
No installation is needed for that.
To run Dart on your own computer, you need the Dart SDK.
SDK means Software Development Kit: the tools you need to run and build Dart programs.
Install the Dart SDK
On Windows, install Dart with winget in a terminal:
Windows
winget install --id=Google.DartSDK -e
On macOS, install Dart with Homebrew:
macOS
brew tap dart-lang/dart
brew trust dart-lang/dart
brew install dart
On Linux, follow the steps for your system on dart.dev/get-dart.
Note: If you install Flutter, the Dart SDK is included.
You do not need to install Dart again.
When the install is done, check the version:
Example
dart --version
Result:
Dart SDK version: 3.14.1 (stable) (Tue Nov 17 00:01:24 2026 -0800) on "windows_x64"
Your version and date can be different.
Your First Dart Program
Create a file called main.dart in any text editor, and write this code:
main.dart
void main() {
print('Hello World');
}
Open a terminal in the same folder, and run the file:
Example
dart run main.dart
Result:
Hello World
Congratulations, you have written and run your first Dart program.
Tip: Visual Studio Code with the free Dart extension is a good editor for Dart.
It colors your code and shows errors while you type.
Compile to a Program
dart compile exe turns your code into a program that runs without the Dart SDK:
Example
dart compile exe main.dart -o hello.exe
Result:
Generated: c:\dart\hello.exe
Now you can run the program directly:
Example
hello.exe
Result:
Hello World
On macOS and Linux, leave out .exe and run it with ./hello.
Create a Dart Project
Bigger programs have many files, so Dart can create a project folder for you:
Example
dart create my_app
The command creates these files:
my_app/
bin/my_app.dart the program starts here
lib/my_app.dart code that the program uses
test/my_app_test.dart tests
pubspec.yaml project name and packages
analysis_options.yaml rules for the code checker
README.md
CHANGELOG.md
Go into the folder and run the project:
Example
cd my_app
dart run
The first time, dart run gets the packages that the project needs.
If the packages are not on your computer yet, it downloads them, so you must be online.
In this tutorial, every example is a single file with a main() function, so you do not need a project to follow along.