Repository navigation
Update widget location tracking to use the new generalized api - #189725
Conversation
There was a problem hiding this comment.
Code Review
This pull request migrates widget creation tracking from the custom internal _Location and _HasCreationLocation implementations to the standard developer.CreationLocation API. It updates WidgetInspectorService to use developer.CreationLocation.of() and replaces the --track-widget-creation compiler flag with --track-creation-locations across the Flutter tools and associated tests. There are no review comments to address, and I have no additional feedback to provide.
|
From the looks if it, we just need to update a bunch of test expectations: |
| for (final Object dartDefine in dartDefines) '-D$dartDefine', | ||
| ...buildModeOptions(buildMode, dartDefines), | ||
| if (trackWidgetCreation) '--track-widget-creation', | ||
| if (trackWidgetCreation) '--track-creation-locations', |
There was a problem hiding this comment.
This flag (and --no-track-widget-creation) are used in tests, and should be migrated as well. For example:
There was a problem hiding this comment.
I only changed the flags passed directly to the compiler invocation. The --track-widget-creation flag of the flutter tool stays as is so there aren't any user-visible changes to the cli flags.
| /// * [StatelessWidget], for widgets that always build the same way given a | ||
| /// particular configuration and ambient state. | ||
| @immutable | ||
| @pragma('track-creation-locations') |
There was a problem hiding this comment.
There was a problem hiding this comment.
Yes this has no effect in release mode.
There was a problem hiding this comment.
Agreed about release mode, and typically I might be concerned about performance in dev mode, but is this just replacing what used to be hardcoded in the Dart SDK (code)?
// Legacy Case: Check for widget class.
if (_isSubclassOfWidget(clazz)) {In which case it should have no real performance cost at all, even in dev mode. @dcharkes can you confirm?
| /// * [StatelessWidget], for widgets that always build the same way given a | ||
| /// particular configuration and ambient state. | ||
| @immutable | ||
| @pragma('track-creation-locations') |
There was a problem hiding this comment.
Agreed about release mode, and typically I might be concerned about performance in dev mode, but is this just replacing what used to be hardcoded in the Dart SDK (code)?
// Legacy Case: Check for widget class.
if (_isSubclassOfWidget(clazz)) {In which case it should have no real performance cost at all, even in dev mode. @dcharkes can you confirm?
Yes, this is just replacing the hardcoded thing in the SDK! |
a058830 to
fbf8c96
Compare
…12393) Manual roll requested by [email protected] flutter/flutter@2a230d1...2757a77 2026-07-29 [email protected] Roll Skia from 3ae9e364d30b to 0f35bba4945c (2 revisions) (flutter/flutter#190215) 2026-07-29 [email protected] [web] Fix deferred loading with wasm (flutter/flutter#190140) 2026-07-29 [email protected] Roll Dart SDK from 1bbaacba6a5a to 43f7de5f4977 (1 revision) (flutter/flutter#190211) 2026-07-29 [email protected] Roll Skia from 119cae396625 to 3ae9e364d30b (6 revisions) (flutter/flutter#190208) 2026-07-29 [email protected] [Win32] Ignore mouse move events without capture when dragging (flutter/flutter#190029) 2026-07-29 [email protected] Roll Dart SDK from 49c637261348 to 1bbaacba6a5a (7 revisions) (flutter/flutter#190196) 2026-07-29 [email protected] Roll Skia from 30ad01017a46 to 119cae396625 (2 revisions) (flutter/flutter#190183) 2026-07-29 [email protected] Fix NestedScrollView example crash when switching tabs on desktop (flutter/flutter#186993) 2026-07-29 [email protected] Roll Fuchsia Linux SDK from OZkZC_2CZ_G5rbMIS... to J8rVTlBnjnUpuHYk3... (flutter/flutter#190174) 2026-07-29 [email protected] Update widget location tracking to use the new generalized api (flutter/flutter#189725) 2026-07-29 [email protected] Avoid unnecessary work in `BoxDecoration` and `RenderPhysicalModel` (flutter/flutter#187891) 2026-07-29 [email protected] Fix web context-menu client lifecycle in SelectableRegion (flutter/flutter#189587) 2026-07-29 [email protected] Roll Skia from 70733f74d415 to 30ad01017a46 (2 revisions) (flutter/flutter#190173) 2026-07-29 [email protected] Manual roll of Dart from 28e63ac22d8d to 49c637261348 (flutter/flutter#190158) 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
This refactors Flutters widget tracking setup to use the new generalized
CreationLocationAPI introduced in dart-lang/sdk@9e8fdefCC @dcharkes
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.