close
Skip to content

Show widget file path in inspector - #9972

Open
khanak0509 wants to merge 3 commits into
flutter:masterfrom
khanak0509:fix-inspector-widget-file-path
Open

Show widget file path in inspector#9972
khanak0509 wants to merge 3 commits into
flutter:masterfrom
khanak0509:fix-inspector-widget-file-path

Conversation

@khanak0509

Copy link
Copy Markdown
Contributor

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:column anywhere — the summary tree is loaded without full details, so creationLocation never 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 show filename.dart:line:column above the properties tabs. The widget tree load stays the same so we don’t pull full details for every node.

before --
Screenshot 2026-08-20 at 7 50 51 PM

after --

Screenshot 2026-08-20 at 7 52 29 PM

Pre-launch Checklist

General checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read the Flutter Style Guide recently, and have followed its advice.
  • I signed the CLA.
  • I updated/added relevant documentation (doc comments with ///).

Issues checklist

Tests checklist

  • I added new tests to check the change I am making...
  • OR there is a reason for not adding tests, which I explained in the PR description.

AI-tooling checklist

  • I did not use any AI tooling in creating this PR.
  • OR I did use AI tooling, and...
    • I read the AI contributions guidelines and agree to follow them.
    • I reviewed all AI-generated code before opening this PR.
    • I understand and am able to discuss the code in this PR.
    • I have verifed the accuracy of any AI-generated text included in the PR description.
    • I commit to verifying the accuracy of any AI-generated code or text that I upload in response to review comments.

Feature-change checklist

  • This PR does not change the DevTools UI or behavior and...
    • I added the release-notes-not-required label or left a comment requesting the label be added.
  • OR this PR does change the DevTools UI or behavior and...
    • I added an entry to packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md.
    • I included before/after screenshots and/or a GIF demo of the new UI to my PR description.
    • I ran the DevTools app locally to manually verify my changes.

build.yaml badge

If you need help, consider asking for help on Discord.

@khanak0509
khanak0509 requested review from a team, kenzieschmoll and srawlins as code owners August 20, 2026 14:29

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/devtools_app/lib/src/screens/inspector/inspector_controller.dart Outdated
Comment thread packages/devtools_app/lib/src/shared/diagnostics/inspector_service.dart Outdated
@khanak0509
khanak0509 force-pushed the fix-inspector-widget-file-path branch from e7abfc7 to f360e4a Compare August 20, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant