[ Widget Preview ] Fix crash when attempting to provide non-const params to a Preview#174242
Merged
auto-submit[bot] merged 1 commit intomasterfrom Aug 22, 2025
Merged
[ Widget Preview ] Fix crash when attempting to provide non-const params to a Preview#174242auto-submit[bot] merged 1 commit intomasterfrom
Preview#174242auto-submit[bot] merged 1 commit intomasterfrom
Conversation
…ams to a `Preview` Instead of crashing, invalid previews should just be ignored. Fixes #173710
Contributor
There was a problem hiding this comment.
Code Review
This pull request fixes a crash that occurs when a Preview annotation is used with non-constant parameters. The fix involves checking if computeConstantValue() returns null and, if so, ignoring the invalid preview instead of crashing. The changes are applied to both single Preview annotations and MultiPreview annotations. Additionally, new tests are added to verify this behavior, and existing test code is refactored for better maintainability by using a mixin. My feedback includes a suggestion to improve code clarity and robustness in one of the changed utility functions.
matanlurey
approved these changes
Aug 21, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Aug 22, 2025
…onst params to a `Preview` (flutter/flutter#174242)
SydneyBao
pushed a commit
to SydneyBao/flutter
that referenced
this pull request
Aug 22, 2025
…ams to a `Preview` (flutter#174242) Instead of crashing, invalid previews should just be ignored. Fixes flutter#173710
SydneyBao
pushed a commit
to SydneyBao/flutter
that referenced
this pull request
Aug 22, 2025
…ams to a `Preview` (flutter#174242) Instead of crashing, invalid previews should just be ignored. Fixes flutter#173710
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Aug 22, 2025
…onst params to a `Preview` (flutter/flutter#174242)
auto-submit bot
pushed a commit
to flutter/packages
that referenced
this pull request
Aug 22, 2025
flutter/flutter@d2ac021...26bb33b 2025-08-22 [email protected] [HCPP] Clean up overlay layer when last frame had overlay content and current doesn't (flutter/flutter#173881) 2025-08-22 [email protected] Migrate more files to use WidgetStateProperty (flutter/flutter#174176) 2025-08-22 [email protected] Roll Skia from 75fef9fb3ed7 to cb15e1452399 (1 revision) (flutter/flutter#174255) 2025-08-22 [email protected] Roll Skia from 006241a7fbe1 to 75fef9fb3ed7 (1 revision) (flutter/flutter#174254) 2025-08-22 [email protected] Skip wasm build when dry run is disabled and --wasm is not specified. (flutter/flutter#174184) 2025-08-22 [email protected] Roll Dart SDK from c153c5259e62 to 4f9623f024ab (2 revisions) (flutter/flutter#174250) 2025-08-22 [email protected] Roll Skia from d70087007490 to 006241a7fbe1 (2 revisions) (flutter/flutter#174252) 2025-08-22 [email protected] Roll Skia from c09589f7ca69 to d70087007490 (22 revisions) (flutter/flutter#174245) 2025-08-21 [email protected] [ Widget Preview ] Add regression test for issue 173895 (flutter/flutter#174037) 2025-08-21 [email protected] Improve xcresult comment and naming (flutter/flutter#173129) 2025-08-21 [email protected] Update `.gemini/styleguide.md` to encourage `master`-only (flutter/flutter#174065) 2025-08-21 [email protected] [ Widget Preview ] Fix crash when attempting to provide non-const params to a `Preview` (flutter/flutter#174242) 2025-08-21 [email protected] Roll Skia from 721e68fe652a to c09589f7ca69 (12 revisions) (flutter/flutter#174162) 2025-08-21 [email protected] Roll Dart SDK from 0d0a0c394381 to c153c5259e62 (7 revisions) (flutter/flutter#174235) 2025-08-21 [email protected] [ Tool ] Throw `ToolExit` when asset entries use absolute paths (flutter/flutter#174230) 2025-08-21 [email protected] Roll Dart SDK from 0d0a0c394381 to c153c5259e62 (7 revisions) (flutter/flutter#174227) 2025-08-21 [email protected] [ Tool ] Cleanup widget preview and frontend server shutdown (flutter/flutter#173863) 2025-08-21 [email protected] Use an alternative to `git describe` for `master` version resolution (flutter/flutter#174088) 2025-08-21 [email protected] Report a correct display ID in the window metrics event on win32 (flutter/flutter#174156) 2025-08-21 [email protected] Revert "Update the AccessibilityPlugin::Announce method to account fo… (flutter/flutter#174223) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
mboetger
pushed a commit
to mboetger/flutter
that referenced
this pull request
Sep 18, 2025
…ams to a `Preview` (flutter#174242) Instead of crashing, invalid previews should just be ignored. Fixes flutter#173710
korca0220
pushed a commit
to korca0220/flutter
that referenced
this pull request
Sep 22, 2025
…ams to a `Preview` (flutter#174242) Instead of crashing, invalid previews should just be ignored. Fixes flutter#173710
Jaineel-Mamtora
pushed a commit
to Jaineel-Mamtora/flutter_forked
that referenced
this pull request
Sep 24, 2025
…ams to a `Preview` (flutter#174242) Instead of crashing, invalid previews should just be ignored. Fixes flutter#173710
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Nov 12, 2025
…onst params to a `Preview` (flutter/flutter#174242)
lucaantonelli
pushed a commit
to lucaantonelli/flutter
that referenced
this pull request
Nov 21, 2025
…ams to a `Preview` (flutter#174242) Instead of crashing, invalid previews should just be ignored. Fixes flutter#173710
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.
Instead of crashing, invalid previews should just be ignored.
Fixes #173710