Skip to content

Provide a way to see inherited values in the Inspector #3084

Open

Description

@filiph

I'm often faced with one of the following questions:

  • Why does this text look like this? (E.g. why is it gray even though I don't tell it to be gray anywhere?)
  • Why doesn't this text react to changes in TextTheme?
  • Where is this text style attribute coming from, exactly?

Text style comes from an inherited widget called DefaultTextStyle. In complex apps, there are several layers of DefaultTextStyle, and Text merges them all into the final style.

In the IntelliJ Flutter inspector (before DevTools integration), it was possible to show the RenderObject/Element tree, and from there, the developer was able to see the debugLabel. It was not perfect, but — as far as I know — it was the only way to debug issues like the ones listed above.

DevTools doesn't have a RenderObject/Element tree (#636), and afaik there is no other way to get to this information.

Screen Shot 2021-06-03 at 5 06 55 PM

For what it's worth, I don't think the "go to the Element tree" method was the best developer experience. If we can surface this information better, that would be amazing. Like, in the widget tree above, I can imagine showing information about the Text's current TextStyle's debugLabel somewhere in that tree.

Activity

  1. added this to the M31 milestone on Jun 5, 2021
  2. modified the milestones: M31, Backlog on Jun 30, 2021
  3. kenzieschmoll commented on Aug 21, 2024

    @kenzieschmoll
    Member

    The debugLabel should be accessible from the widget's render object, which can be evaluated and dumped to console in the Inspector. However, I will keep this FR open to track creating a better UX to understand inherited values.

  4. changed the title [-]Provide a way to see TextStyle debugLabels[/-] [+]Provide a way to see inherited values in the Inspector[/+] on Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions