dart-lang / dart_style

An opinionated formatter/linter for Dart code
https://pub.dev/packages/dart_style
BSD 3-Clause "New" or "Revised" License
649 stars 120 forks source link

Don't move a comment between a modifier and return type. #1588

Closed munificent closed 1 month ago

munificent commented 1 month ago

When formatting a function, method, getter, or function type, the formatter hoists any leading comments out so that they don't force a split between the return type and body.

However, it failed to take into account modifiers that may occur before the return type but after the comment. If that happened, the comment would get moved before the modifiers.

Fix #1585.