Skip to content

Add toString methods for window positioner classes#182857

Merged
mattkae merged 1 commit into
flutter:masterfrom
robert-ancell:windowing-positioner-tostring
Feb 25, 2026
Merged

Add toString methods for window positioner classes#182857
mattkae merged 1 commit into
flutter:masterfrom
robert-ancell:windowing-positioner-tostring

Conversation

@robert-ancell

Copy link
Copy Markdown
Contributor

Useful for debugging.

@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions Bot added the framework flutter/packages/flutter repository. See also f: labels. label Feb 24, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds toString() methods to WindowPositionerConstraintAdjustment and WindowPositioner to aid in debugging. My review focuses on improving the code style and formatting of these new methods to align with the repository's guidelines. I've suggested using an expression body for conciseness and formatting long strings to improve readability.

Comment on lines +263 to +265
@override
String toString() =>
'WindowPositionerConstraintAdjustment(flipX: $flipX, flipY: $flipY, slideX: $slideX, slideY: $slideY, resizeX: $resizeX, resizeY: $resizeY)';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This toString implementation results in a very long line of code, which goes against the repository's style guide that enforces dart format and its line length limits. For better readability and to adhere to the style guide, please format this long string to span multiple lines.

  @override
  String toString() => 'WindowPositionerConstraintAdjustment('
      'flipX: $flipX, '
      'flipY: $flipY, '
      'slideX: $slideX, '
      'slideY: $slideY, '
      'resizeX: $resizeX, '
      'resizeY: $resizeY)';
References
  1. All Dart code should be formatted using dart format, which typically enforces an 80-character line limit to maintain readability. This is specified on line 36 of the repository style guide. (link)

Comment on lines +509 to +512
@override
String toString() {
return 'WindowPositioner(parentAnchor: $parentAnchor, childAnchor: $childAnchor, offset: $offset, constraintAdjustment: $constraintAdjustment)';
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency and to adhere to Effective Dart style guidelines (referenced in the repo style guide), it's better to use an expression body (=>) for this simple one-line method. Additionally, the resulting string is very long and should be formatted across multiple lines to respect the line length limit.

  @override
  String toString() => 'WindowPositioner('
      'parentAnchor: $parentAnchor, '
      'childAnchor: $childAnchor, '
      'offset: $offset, '
      'constraintAdjustment: $constraintAdjustment)';
References
  1. The repository style guide (line 20) defers to 'Effective Dart: Style', which recommends using => for simple one-line members for conciseness. (link)
  2. All Dart code should be formatted using dart format, which typically enforces an 80-character line limit to maintain readability. This is specified on line 36 of the repository style guide. (link)

@mattkae mattkae left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing

@mattkae mattkae added this pull request to the merge queue Feb 25, 2026
Merged via the queue into flutter:master with commit 5329e94 Feb 25, 2026
71 of 72 checks passed
github-merge-queue Bot pushed a commit that referenced this pull request Feb 26, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 26, 2026
ahmedsameha1 pushed a commit to ahmedsameha1/flutter that referenced this pull request Feb 27, 2026
ahmedsameha1 pushed a commit to ahmedsameha1/flutter that referenced this pull request Feb 27, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2026
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2026
xxxOVALxxx pushed a commit to xxxOVALxxx/flutter that referenced this pull request Mar 10, 2026
xxxOVALxxx pushed a commit to xxxOVALxxx/flutter that referenced this pull request Mar 10, 2026
mboetger pushed a commit to mboetger/flutter that referenced this pull request Mar 26, 2026
mboetger pushed a commit to mboetger/flutter that referenced this pull request Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants