Skip to content

Seal the geometry classes#183988

Open
nate-thegrate wants to merge 1 commit intoflutter:masterfrom
nate-thegrate:sealed-geometry
Open

Seal the geometry classes#183988
nate-thegrate wants to merge 1 commit intoflutter:masterfrom
nate-thegrate:sealed-geometry

Conversation

@nate-thegrate
Copy link
Contributor

Abstract private fields are problematic, since they can only be implemented by subtypes within the same library.

The sealed class modifier solves this beautifully.


This PR applies the modifier to the three geometry classes that need it.

@flutter-dashboard
Copy link

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 Mar 21, 2026
Copy link
Contributor

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

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 updates three geometry base classes, AlignmentGeometry, BorderRadiusGeometry, and EdgeInsetsGeometry, to use the sealed class modifier instead of abstract. This change makes the class hierarchy closed and explicit, preventing implementations outside of the library.

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.

1 participant