dart format <files-or-directory>

Idiomatically format Dart source code

Arguments

NameDescription
files-or-directoryThe files or directories to format

Options

NameDescription
-h, --helpPrint this usage information
-v, --verboseShow all options and flags with --help
-o, --output <json> <none> <show> <write> <--show> <--summary>Set where to write formatted output
--set-exit-if-changedReturn exist code 1 if there are any formatting changes
--fixApply all style fixes
--fix-doc-commentsUse triple slash for documentation comments
--fix-function-typedefsUse new syntax for function type typedefs
--fix-named-default-separatorUse '=' as the separator before named parameter default values
--fix-optional-constRemove 'const' keyword inside constant context
--fix-optional-newRemove 'new' keyword
--fix-single-cascade-statementsRemove unnecessary single cascades from expression statements
-l, --line-length <line-length>Wrap lines longer than this. Defaults to 80
-i, --indent <number-of-spaces>Add this many spaces of leading indentation
--follow-linksFollow links to files and directories. If unset, links will be ignored
--versionShow dart_style version
--selectionTrack selection (given as 'start:length') through formatting
--stdin-name <name>Use this path in error messages when input is read from stdin. (defaults to 'stdin')