dart
command-line interface for the Dart programming language
TLDR
Run a Dart file directly
SYNOPSIS
dart [OPTIONS] [COMMAND] [ARGS]
dart [DARTFILE_]
DESCRIPTION
dart is the command-line interface for the Dart programming language. It provides tools for running, compiling, testing, and managing Dart applications and packages.
Dart can run programs directly in the Dart VM with JIT compilation, or compile them to native executables, JavaScript, or WebAssembly for deployment. The dart pub subcommand manages package dependencies defined in pubspec.yaml.
The tool supports project templates for different application types including console applications, packages, and web applications. Code analysis and formatting tools help maintain consistent, error-free code.
PARAMETERS
-h, --help
Display help information.--version
Display the Dart SDK version.-v, --verbose
Show additional diagnostic output.--enable-experiment=NAME
Enable experimental language features.
COMMANDS
run [DARTFILE_]
Run a Dart program in the Dart VM.create DIRECTORY
Create a new project. Use -t for templates (console, package, web).compile FORMAT
Compile Dart to various formats: exe (native), js (JavaScript), aot-snapshot, jit-snapshot, kernel.analyze [DIRECTORY|FILE]
Analyze Dart source code for errors and warnings.format [DIRECTORY|FILE]
Format Dart source code according to style guidelines.fix [DIRECTORY|FILE]
Apply automated fixes to Dart source code.test [DIRECTORY|FILE]
Run tests in the package.pub SUBCOMMAND
Work with packages (get, upgrade, publish, etc.).doc DIRECTORY
Generate API reference documentation.devtools
Launch Dart DevTools for debugging and profiling.info
Output Dart tooling diagnostic information.
CAVEATS
Dart applications require the Dart SDK for development. Native compiled executables are platform-specific. When using packages, always run dart pub get after modifying pubspec.yaml. Some experimental features require explicit opt-in via --enable-experiment.
HISTORY
Dart was developed by Google and first announced in 2011. It was initially designed as an alternative to JavaScript for web development. With Dart 2.0 in 2018, the language became strongly typed. The Flutter framework, also using Dart, drove significant adoption starting in 2017. The unified dart command-line tool replaced separate tools like pub, dartanalyzer, and dartfmt in Dart 2.10 (2020).
