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
Fix MultiChildLayoutDelegate.hasChild
doc
#126433
Fix MultiChildLayoutDelegate.hasChild
doc
#126433
Conversation
c28ba4b
to
1ba1bd7
Compare
/// Avoid calling this from [getSize] as the child list is not available | ||
/// until layout size is determined. |
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.
"Avoid" is probably to weak here, this crashes if you call it from getSize, right? Maybe better:
"This method cannot be called from [getSize] as the size is not allowed to depend on the children" or something like that.
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.
LGTM
fixes flutter#115898 `hasChild` checks `_idToChild` map. `_idToChild` is not assigned until `_callPerformLayout` is called. So `hasChild` shouldn't be called in `getSize`. https://github.com/flutter/flutter/blob/df789c9e76098e82f80f2c5de8b5560f360afa40/packages/flutter/lib/src/rendering/custom_layout.dart#L400-L404 Updated docs and example class names.
fixes #115898
hasChild
checks_idToChild
map._idToChild
is not assigned until_callPerformLayout
is called.So
hasChild
shouldn't be called ingetSize
.flutter/packages/flutter/lib/src/rendering/custom_layout.dart
Lines 400 to 404 in df789c9
Updated docs and example class names.
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.