dart command-line tool is the primary interface for Dart development. It provides a unified entry point for running Dart programs, managing packages, analyzing code, and more.
Overview
Thedart tool consolidates various development tasks into a single command-line interface:
Global Options
These options apply to alldart commands:
Analytics Options
Available Commands
analyze
Analyze Dart code in a directory.compile
Compile Dart to various formats.js- Compile to JavaScriptjit-snapshot- Compile to JIT snapshotkernel- Compile to kernel snapshotexe- Compile to native executableaot-snapshot- Compile to AOT snapshotwasm- Compile to WebAssembly
create
Create a new Dart project.console- A command-line application (default)package- A package containing shared Dart librariesweb- A web applicationserver-shelf- A server app using package:shelf
devtools
Open Dart DevTools for debugging and profiling.doc
Generate API documentation for Dart projects.fix
Apply automated fixes to Dart source code.format
Format Dart source code.info
Show diagnostic information about the installed tooling.pub
Work with packages using the Pub package manager.run
Run a Dart program.VM Options
You can pass VM options before the script name:test
Run tests for a project.Running Dart Programs
You can run Dart programs directly without therun command:
VM Flags
When running Dart programs, you can pass flags to the VM:Experiments
Enable experimental language features:Environment Variables
DART_VM_OPTIONS
Set default VM options:PUB_CACHE
Set the location of the package cache:Exit Codes
Thedart command uses the following exit codes:
0- Success64- Usage error (invalid arguments)65- Command-specific error254- Compilation error or file not found255- Unexpected error