refactor(naked_ui): derive state equality from props - #259
Open
tilucasoli wants to merge 3 commits into
Open
tilucasoli wants to merge 3 commits into
tilucasoli wants to merge 3 commits into
Conversation
tilucasoli
added this pull request to stack #251
September 29, 2026 02:00
tilucasoli
force-pushed
the
leoafarias/naked-state-props
branch
2 times, most recently
from
September 29, 2026 02:42
787caaf to
7f50727
Compare
Every NakedState subclass hand-wrote `operator ==` and `hashCode`, so a new field had to be added in three places and was silently dropped from equality when it was not. Port Mix's props-based equality into naked_ui as a self-contained copy (the package keeps no dependency on mix): a DeepCollectionEquality and a NakedEquatable mixin that derives `==` and `hashCode` from `List<Object?> get props`. NakedState mixes it in with `props => [states]`, and subclasses append their own fields. The propsEquals/propsHash helpers stay unexported because mix exports the same names and re-exporting them makes those imports ambiguous in remix. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
tilucasoli
force-pushed
the
leoafarias/naked-state-props
branch
from
September 29, 2026 11:58
7f50727 to
f645cb6
Compare
4 of 5 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Derives
NakedStateequality and hashing frompropsso adding a state field no longer requires separate hand-written equality and hash implementations. All 20 state classes migrate to this convention, with a runtime-type guard and no dependency on Mix.The collection helper preserves ordered lists and unordered maps/sets. Nested map values and set elements are compared and hashed recursively, so equal independently allocated collections remain findable in hash-based collections.
Only
NakedEquatableis exported; the similarly named Mix helpers remain unambiguous. Stacked on #250.Tests
Related Issues
None.
Checklist
Breaking Change
NakedStatesubclasses using the removed protectedstatesEqual/statesHashCodehelpers.Move additional equality fields into
props => [...super.props, ...]; the base state already includes widget states.