Dart is a client-optimized language for fast apps on any platform. It’s the language behind Flutter.
Install
macOS:
brew tap dart-lang/dart
brew install dart
Linux:
# Using apt (Debian/Ubuntu)
sudo apt-get install dart
Windows: Download the SDK from dart.dev/get-dart or use Chocolatey:
choco install dart-sdk
Verify:
dart --version
# Dart SDK version: 3.5.0
Create a Project
dart create myapp
cd myapp
This generates a project with a pubspec.yaml and a bin/ directory.
Dependencies
Add packages via pubspec.yaml or the command line:
dart pub add http
Fetch dependencies:
dart pub get
First Program
Create bin/main.dart:
void main() {
print('Hello, Dart!');
}
Run it:
dart run bin/main.dart
Compile to a native binary:
dart compile exe bin/main.dart
./main
Next: Basics