Skip to content

Allow requesting a reduced widget tree with getRootWidgetTree service extension - #157309

Merged
elliette merged 16 commits into
flutter:masterfrom
elliette:smaller-widget-tree
Oct 23, 2024
Merged

Allow requesting a reduced widget tree with getRootWidgetTree service extension#157309
elliette merged 16 commits into
flutter:masterfrom
elliette:smaller-widget-tree

Conversation

@elliette

@ellietteelliette commented Oct 21, 2024

Copy link
Copy Markdown
Member

Work towards flutter/devtools#1423

Reduces the widget tree payload sent back from getRootWidgetTree when the fullDetails parameter is false.

getRootWidgetTree payload size comparison (for the Flutter gallery):

  • with fullDetails=true: 1,367,692 bytes
  • with fullDetails=false: 446,696 bytes

The fullDetails=false payload is approximately a third of the size of the original payload.

@github-actionsgithub-actionsBot added the framework flutter/packages/flutter repository. See also f: labels. label Oct 21, 2024
Comment threadpackages/flutter/lib/src/foundation/diagnostics.dart Outdated
Comment threadpackages/flutter/lib/src/foundation/diagnostics.dart Outdated
Comment threadpackages/flutter/lib/src/foundation/diagnostics.dart Outdated
Comment threadpackages/flutter/lib/src/foundation/diagnostics.dart
Comment threadpackages/flutter/lib/src/foundation/diagnostics.dart
Comment threadpackages/flutter/lib/src/widgets/widget_inspector.dart Outdated
@ellietteelliette changed the title Allow requesting an abbreviated widget tree with getRootWidgetTree service extensionAllow requesting a reduced widget tree with getRootWidgetTree service extensionOct 22, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 24, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 24, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 24, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 25, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 25, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 25, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 25, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 25, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 26, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 26, 2024
M97Chahboun pushed a commit to M97Chahboun/flutter that referenced this pull request Oct 30, 2024
github-merge-queueBot pushed a commit that referenced this pull request Nov 26, 2024
…esting a large widget tree (#159454)
Fixesflutter/devtools#8553
Context: A Flutter web customer with a large widget tree was getting a stack
overflow error when they toggled on "show implementation widgets" in the
Flutter DevTools Inspector. This is because building the JSON tree
recursively was hitting Chrome's stack limit.
This PR creates the JSON tree **iteratively** if the `getRootWidgetTree`
service extension is called with `fullDetails = false` (which is what
DevTools uses to fetch the widget tree).
For all other instances of creating a widget JSON map (for example, when
fetching widget properties) the recursive implementation is used. This
allows properties provided by subclasses implementing `toJsonMap` to be
included in the response.
Note: Because with this change `toJsonMap` is only called when
`fullDetails = true` and `toJsonMapIterative` is only called when
`fullDetails = false`, this PR partially reverts the changes in
#157309.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 12, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 13, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 6, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Mar 7, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frameworkflutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@elliette@kenzieschmoll