3.3
to parse so that code with extension types can be formatted.macro
modifier when the macros
experiment flag is passed.tall-style
experiment flag to enable the in-progress unstable new formatting style (#1253).inline class
since that syntax has changed.--enable-experiment
command-line option to enable language experiments. The library API also supports this with DartFormatter.experimentFlags
..
following a record literal (#1213).package:analyzer
>=5.12.0 <7.0.0
.?
on nullable empty record types (#1224).--fix
and related options in --help
. The options are still there and supported, but are no longer shown by default. Eventually, we would like all users to move to using dart fix
instead of dart format --fix
.||
pattern operands in switch expression cases.sealed
, interface
, and final
keywords on mixin declarations. The proposal was updated to no longer support them.base
, final
, interface
, mixin
, and sealed
.inline class
declarations.sync*
and async*
functions with =>
bodies.<
in collection literals._visitFunctionOrMethodDeclaration
instead of dynamically typed.(
significant (sdk#50769).package:analyzer
^5.7.0
.{
or [
and a subsequent comment. It used to do this before the {
in type bodies, but not switch bodies, optional parameter sections, or named parameter sections.package:analyzer
>=4.4.0 <6.0.0
.package:analyzer
.package:analyzer
version 2.6.0
.NamedType
instead of TypeName
./* */
comments (#837).FormatCommand
when formatting stdin (#1035).package:analyzer
.>>>
and >>>=
operators (#992).required
(#1010).FormatCommand.run()
now returns the value set in exitCode
during formatting.package:analyzer
.package:args
and package:pub_semver
.?
in initializing formal function-typed parameters (#960).?:
) when they are nested (#927).external
and abstract
fields and variables (#946).--stdin-name=<stdin>
.--fix-single-cascade-statements
.var
in --fix-function-typedefs
(#826).?.[]
to ?[]
.package:analyzer
0.39.0
.?
in types.late
modifier.required
modifier..
when the target is parenthesized (#704).package:analyzer
0.38.0
.package:analyzer
0.37.0
.=>
functions.Properly format trailing commas in assertions.
Improve indentation of adjacent strings. This fixes a regression introduced in 1.2.5 and hopefully makes adjacent strings generally look better.
Adjacent strings in argument lists now format the same regardless of whether the argument list contains a trailing comma. The rule is that if the argument list contains no other strings, then the adjacent strings do not get extra indentation. This keeps them lined up when doing so is unlikely to be confused as showing separate independent string arguments.
Previously, adjacent strings were never indented in argument lists without a trailing comma and always in argument lists that did. With this change, adjacent strings are still always indented in collection literals because readers are likely to interpret a series of unindented lines there as showing separate collection elements.
if
and for
elements inside collections (#779).package:analyzer
constraint to '>=0.33.0 <0.36.0'
.--fix-function-typedefs
to convert the old typedef syntax for function types to the new preferred syntax.--stdin-name
to specify name shown when reading from stdin (#739).--fix-doc-comments
to turn /** ... */
doc comments into ///
(#730).const
in all metadata annotations with --fix-optional-const` (#720).Preserve whitespace in multi-line strings inside string interpolations (#711). Note! This bug means that dart_style 1.1.2 may make semantics changes to your strings. You should avoid that version and use 1.1.3.
Set max SDK version to <3.0.0, and adjusted other dependencies.
:
to =
as the named parameter default value separator.new
keywords.const
keywords.package:analyzer
..
if the target expression is an argument list with a trailing comma (#548, #665).new
/const
(#652).pkg/args
.pkg/analyzer
.-
and --
(#170).=>
bodies (#584).<
when a collection is in statement position (#589).covariant
modifier on methods.is
and as
expressions.--set-exit-if-changed
to set the exit code on a change (#365).--version
command line argument (#240)..
in a method chain if the target splits (#255).=>
bodies (#434.if
statements without curly bodies better (#448).get
and set
(#462).--indent
to specify leading indent (#464).for
fully split if initializers or updaters do (#375, #377).deferred
(#381).as
and is
expressions (#384).?.
, ??
, and ??=
) (#385).BREAKING: The indent
argument to new DartFormatter()
is now a number of spaces, not indentation levels.
This version introduces a new n-way constraint system replacing the previous binary constraints. It‘s mostly an internal change, but allows us to fix a number of bugs that the old solver couldn’t express solutions to.
In particular, it forces argument and parameter lists to go one-per-line if they don't all fit in two lines. And it allows function and collection literals inside expressions to indent like expressions in some contexts. (#78, #97, #101, #123, #139, #141, #142, #143, et. al.)
Indent cascades more deeply when the receiver is a method call (#137).
Preserve newlines in collections containing line comments (#139).
Allow multiple variable declarations on one line if they fit (#155).
Prefer splitting at “.” on non-identifier method targets (#161).
Enforce a blank line before and after classes (#168).
More precisely control newlines between declarations (#173).
Preserve mandatory newlines in inline block comments (#178).
Splitting inside type parameter and type argument lists (#184).
Nest blocks deeper inside a wrapped conditional operator (#186).
Split named arguments if the positional arguments split (#189).
Re-indent line doc comments even if they are flush left (#192).
Nest cascades like expressions (#200, #203, #205, #221, #236).
Prefer splitting after =>
over other options (#217).
Nested non-empty collections force surrounding ones to split (#223).
Allow splitting inside with and implements clauses (#228, #259).
Allow splitting after =
in a constructor initializer (#242).
If a =>
function's parameters split, split after the =>
too (#250).
Allow splitting between successive index operators (#256).
Correctly indent wrapped constructor initializers (#257).
Set failure exit code for malformed input when reading from stdin (#359).
Do not nest blocks inside single-argument function and method calls.
Do nest blocks inside =>
functions.
test
package runner internally.analyzer
and args
packages.dartformat
to dartfmt
.--dry-run
option to show files that need formatting (#67).await for
statements (#154).-
calls (#170).-t
flag to preserve compatibility with old formatter (#166).--machine
flag for machine-readable output (#164).