-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Error message for setting shaderWarmUp too late #30145
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
Conversation
Developers may get confused by setting PaintingBinding.shaderWarmUp in the wrong place. The added assert and error message help avoid that.
|
@InMatrix : please let me know if the error message conforms your UX research results :) |
mklim
left a comment
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
| assert(_instance == null, | ||
| 'PaintingBinding.shaderWarmUp should only be set before the ' | ||
| 'PaintingBinding singleton instance is initialized.\n\n' | ||
| 'Set it after init would not affect how shaders are warmed up.\n\n' |
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.
small nit:
| 'Set it after init would not affect how shaders are warmed up.\n\n' | |
| 'Setting it after init does not affect how shaders are warmed up.\n\n' |
"Set" here makes it sound like a command so it's confusing as is, because I think this sentence is really talking about the times when this is set after init and not telling the reader to set it after init. "Setting" changes it to a gerund and the subject of this sentence, which makes more sense. Then the "would" to "does" here change follows to match 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.
Done.
| /// * [ShaderWarmUp], the interface of how this warm up works. | ||
| static ShaderWarmUp shaderWarmUp = const DefaultShaderWarmUp(); | ||
| static ShaderWarmUp get shaderWarmUp => _shaderWarmUp; | ||
| static void set shaderWarmUp(ShaderWarmUp value) { |
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.
nit: This is failing the analyzer. "Avoid return types on setters"
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.
Thank you very much for the suggestion! Done.
|
@liyuqian Thanks for pinging me. Being unfamiliar with the code, I can't really tell if the message is sufficient. But it's certainly a step towards the right direction. |
This reverts commit ffbb335. Reason for revert: flutter driver tests may have bugs in getting first frame. Revert this until we figure out what happened.
Description
Developers may get confused by setting
PaintingBinding.shaderWarmUpinthe wrong place. The added assert and error message help avoid that.
Related Issues
#813
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?