-
-
Notifications
You must be signed in to change notification settings - Fork 934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add HasAncestor
mixin
#1711
Conversation
} | ||
assert( | ||
_ancestor != null, | ||
'An ancestor must be of type $T in the component tree', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'An ancestor must be of type $T in the component tree', | |
'Component of type $runtimeType has to have an ancestor of type $T in the component tree', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assertion will already throw with a stack trace that relates to the component. Not sure if this would have any benefit directly then?
If we do this we should do that for the ParentIsA
and HasGameRef
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a suggestion on a better error message. Rather than searching the trace for the root of the problem, having the runtime type on the message can be helpful. If the case is for consistency, we can improve this and all related messages in a future PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea would love to do that in a follow up PR then! As we might have more assertions that could use some love probably
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just some small nits
…/flame into feat/add-has-ancestor-mixin
Description
Add a mixin that ensures a component requires a certain ancestor in it's component tree.
Checklist
fix:
,feat:
,docs:
etc).docs
and added dartdoc comments with///
.examples
.Breaking Change
Related Issues