Dart: Running Code & Tools
Running Dart
Install the Dart SDK from dart.dev. Then:
dart run main.dart # compile and run
dart compile exe main.dart # compile to native binary
dart analyze # static analysis / linting
dart format # auto-format code
Flutter (Dart's main use case)
Flutter is a UI toolkit by Google that uses Dart. It compiles to native ARM code for mobile, web, and desktop from one codebase.
flutter create my_app # scaffold a new Flutter project
flutter run # run on connected device or emulator
flutter build ios # build iOS release
flutter build apk # build Android release
flutter build web # build for web
flutter test # run Flutter tests
Editors / IDEs
- VS Code — install the Dart extension and Flutter extension by Dart Code
- Android Studio — install the Flutter plugin (Dart bundled)
- IntelliJ IDEA — install the Flutter plugin
Pub (package manager)
dart pub add http # add dependency to pubspec.yaml
dart pub get # fetch all dependencies
dart pub upgrade # update all dependencies
dart pub outdated # list outdated packages
Key packages (pub.dev)
| Package | What it does |
|---|---|
http |
HTTP client for API calls |
provider |
State management |
shared_preferences |
Key-value local storage |
path_provider |
Find file system paths |
intl |
Internationalization (dates, numbers, translations) |
Quick check below!