Formatted with ^3.6.0 specified in pubspec.yaml
class Report {
final Event event;
final List<Item> _items;
Report(this.event, this._items);
Iterable<Item> get all => _items;
List<Relation> relations() => [Relation(_items[0], _items[1])]; // stub
List<ItemDetail> get itemDetails => switch (event) {
EventPartial _ => all
.map(
(item) => ItemDetail(
item,
relations()
.map(
(relation) => RelationDetail(
relation,
Details.getRelationText(relation),
),
)
.toList(),
),
)
.toList(),
_ => throw UnimplementedError(),
};
List<RelationDetail> get relationDetails => all
.expand((item) => relations())
.map(
(relation) =>
RelationDetail(relation, Details.getRelationText(relation)),
)
.toList();
}
Formatted with ^3.7.0 specified in pubspec.yaml
class Report {
final Event event;
final List<Item> _items;
Report(this.event, this._items);
Iterable<Item> get all => _items;
List<Relation> relations() => [Relation(_items[0], _items[1])]; // stub
List<ItemDetail> get itemDetails => switch (event) {
EventPartial _ =>
all
.map(
(item) => ItemDetail(
item,
relations()
.map(
(relation) => RelationDetail(
relation,
Details.getRelationText(relation),
),
)
.toList(),
),
)
.toList(),
_ => throw UnimplementedError(),
};
List<RelationDetail> get relationDetails =>
all
.expand((item) => relations())
.map(
(relation) =>
RelationDetail(relation, Details.getRelationText(relation)),
)
.toList();
}
Formatted with ^3.9.0 specified in pubspec.yaml
class Report {
final Event event;
final List<Item> _items;
Report(this.event, this._items);
Iterable<Item> get all => _items;
List<Relation> relations() => [Relation(_items[0], _items[1])]; // stub
List<ItemDetail> get itemDetails => switch (event) {
EventPartial _ =>
all
.map(
(item) => ItemDetail(
item,
relations()
.map(
(relation) => RelationDetail(
relation,
Details.getRelationText(relation),
),
)
.toList(),
),
)
.toList(),
_ => throw UnimplementedError(),
};
List<RelationDetail> get relationDetails => all
.expand((item) => relations())
.map(
(relation) =>
RelationDetail(relation, Details.getRelationText(relation)),
)
.toList();
}
What output did you expect or want the formatter to produce?
The issue for me is the handling of the => in the switch expression. I prefer the output of v3.6.0 as the additional line break between the arrow "=>" and "all" is both jarring and creates an unnecessary extra level of indentation making it harder to read.
Formatted with ^3.6.0 specified in pubspec.yaml
Formatted with ^3.7.0 specified in pubspec.yaml
Formatted with ^3.9.0 specified in pubspec.yaml
What output did you expect or want the formatter to produce?
The issue for me is the handling of the => in the switch expression. I prefer the output of v3.6.0 as the additional line break between the arrow "=>" and "all" is both jarring and creates an unnecessary extra level of indentation making it harder to read.