Show widget file path in inspector - #9972
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the display of a widget's creation source location (file name, line, and column) in the DevTools Inspector. It updates the InspectorController to fetch this information from the details subtree, adds a new WidgetCreationLocationHeader widget to display it, and includes corresponding unit tests. The review feedback highlights a potential crash if the controller is disposed during an asynchronous operation, suggests a defensive null check for the node ID in getDetailsSubtree, and recommends using a null-assertion operator to satisfy strict null safety in the creation location header.
e7abfc7 to
f360e4a
Compare
|
Instead of making it a header above the properties tab view, let's add it to the tab view directly by setting the
|
|
Makes sense -- moved it to the trailing widget. Done! |
|
Updated PR description.. |
Issue #9922
This PR fixes issue #9922 where the new Flutter Inspector didn’t show the widget’s file path like the legacy inspector did. You could select a widget and see layout/properties on the right, but there was no
main.dart:line:columnanywhere — the summary tree is loaded without full details, socreationLocationnever showed up in the UI.How I fixed it:
Basically, when a widget is selected we fetch a small details subtree for just that node, read
creationLocation, and showfilename.dart:line:columnabove the properties tabs. The widget tree load stays the same so we don’t pull full details for every node.before --

after --

Pre-launch Checklist
General checklist
///).Issues checklist
contributions-welcomeorgood-first-issuelabel.contributions-welcomeorgood-first-issuelabel. I understand this means my PR might take longer to be reviewed.Tests checklist
AI-tooling checklist
Feature-change checklist
release-notes-not-requiredlabel or left a comment requesting the label be added.packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md.If you need help, consider asking for help on Discord.