What input code did you provide to the formatter?
enum Test2 {
x('example'),
y('example2'),
z('example3');
const Test2(this.someVariable);
final String someVariable;
}
What output did the formatter produce?
enum Test2 {
x('example'),
y('example2'),
z('example3')
;
const Test2(this.someVariable);
final String someVariable;
}
What output did you expect or want the formatter to produce?
The formatter shouldn't move the semicolon into a new line.
enum Test2 {
x('example'),
y('example2'),
z('example3');
const Test2(this.someVariable);
final String someVariable;
}
Anything else we should know?
I just upgraded to Flutter 3.38.0 (using Dart 3.10.0-290.4.beta) and noticed that dart format results in some strange formatting results for enums that use parameters. Enums without parameters are unaffected.
Use the following content in analysis_options.yaml:
formatter:
trailing_commas: preserve
I created a minimum reproducable example in https://github.com/josxha/dart_format_test
The bug gets reproduced in this commit: josxha/dart_format_test@e0a8f0d
I was able to reproduce this issue in the following versions of Dart:
- Dart
3.10.0-290.4.beta on Windows 11 amd64, used in the stable Flutter 3.38.0 release
- Dart
3.11.0-93.1.beta using docker run --rm -it -v ${PWD}:/test dart:3.11.0-93.1.beta dart format /test