Skip to content

package:dart_style v3.1.8

Choose a tag to compare

@kevmoo kevmoo released this 19 Mar 05:07
· 16 commits to main since this release
2d8c5dc

Style changes

  • Format extension type representation clauses the same way primary constructor
    formal parameter lists are formatted. This rarely makes a difference but
    produces better formatting when the representation type is long and there are
    other clauses on the extension type, as in:
    // Before:
    extension type JSExportedDartFunction._(
      JSExportedDartFunctionRepType _jsExportedDartFunction
    )
        implements JSFunction {}
    // After:
    extension type JSExportedDartFunction._(
      JSExportedDartFunctionRepType _jsExportedDartFunction
    ) implements JSFunction {}
    This change is not language versioned. (The old style is always worse, and
    continuing to support it would add complexity to the formatter.)
  • Force blank lines around a mixin or extension type declaration if it doesn't
    have a ; body:
    // Before:
    int above;
    extension type Inches(int x) {}
    mixin M {}
    int below;
    // After:
    int above;
    extension type Inches(int x) {}
    mixin M {}
    int below;
    The formatter already forces blank lines around class, enum, and extension
    declarations. Mixins and extension types were overlooked. This makes them
    consistent. This style change is language versioned and only affects
    libraries at 3.13 or higher.
    Note that the formatter allows classes and extension types whose body is ;
    to not have a blank line above or below them.

Internal changes

  • Support upcoming Dart language version 3.13.
  • Support formatting primary constructors.
  • Require analyzer: '^12.0.0'.