Skip to content

Changes to use valuenotifier instead of a force rebuild for WidgetInspector - #131634

Merged
CoderDake merged 31 commits into
flutter:masterfrom
CoderDake:no-force-rebuild
Oct 13, 2023
Merged

CoderDake merged 31 commits into
flutter:masterfrom
CoderDake:no-force-rebuild

Conversation

@CoderDake

@CoderDake CoderDake commented Jul 31, 2023 •

Copy link
Copy Markdown
Contributor


Fixes flutter/devtools#6014

Change the forceRebuild behaviour of the WidgetInspector to use ValueListenableBuilders instead. This should help resolve heavy rebuilds when the widgetInspectorOverride value changes.

@github-actions github-actions Bot added the framework flutter/packages/flutter repository. See also f: labels. label Jul 31, 2023
@github-actions github-actions Bot added the c: tech-debt Technical debt, code quality, testing, etc. label Aug 2, 2023
Comment thread packages/flutter/lib/src/widgets/app.dart Outdated
@CoderDake
CoderDake requested review from jacob314 and keertip August 9, 2023 14:19
@CoderDake
CoderDake marked this pull request as ready for review August 9, 2023 14:21
Comment thread packages/flutter/lib/src/widgets/app.dart Outdated
Comment thread packages/flutter/lib/src/widgets/widget_inspector.dart Outdated
Comment thread packages/flutter/test/widgets/widget_inspector_test.dart

@jacob314 jacob314 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.

LGTM after fixing a couple minor issues.

/// and view what widgets and render objects associated with it. An outline of
/// the selected widget and some summary information is shown on device and
/// more detailed information is shown in the IDE or DevTools.
static ValueNotifier<bool> debugShowWidgetInspectorOverrideNotifier = ValueNotifier<bool>(false);

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.

Fyi @goderbauer. I'd like your opinion on the naming convention to use for a debug override like this.
If it wasn't for the conflict with the deprecated name, would we want to call this just
debugShowWeidgetInspectorOverride even though the type is ValueNotifier?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why the "override" in this name? What is getting overridden? The answer should be added to the docs.

Wondering: Why does the Notifier need to be part of the public API? It seems like it could be private, only exposing a public getter/setter to change its value since there do not appear to be any clients outside of this file that need to listen to the listenable? The public getter/setter could be the existing debugShowWidgetInspectorOverride, so there wouldn't be a need for new API surface at all...

@jacob314 jacob314 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.

LGTM after fixing a couple minor issues.

@CoderDake
CoderDake requested a review from goderbauer August 29, 2023 13:39

@goderbauer goderbauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Implementation looks good, but some checks are unhappy.

Comment thread packages/flutter/lib/src/widgets/app.dart Outdated
Comment thread packages/flutter/lib/src/widgets/app.dart Outdated
Comment thread packages/flutter/lib/src/widgets/app.dart Outdated
Comment thread packages/flutter/lib/src/widgets/app.dart Outdated
@CoderDake CoderDake changed the title Initial changes to use valuenotifier instead of a force rebuild Changes to use valuenotifier instead of a force rebuild for WidgetInspector Oct 11, 2023
/// the selected widget and some summary information is shown on device and
/// more detailed information is shown in the IDE or DevTools.
static bool debugShowWidgetInspectorOverride = false;
@visibleForTesting

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We try to avoid this because at the end of the day it is still public API.

Instead of using WidgetsApp.debugShowWidgetInspectorOverrideNotifier.value the test could be using the public WidgetsApp.debugShowWidgetInspectorOverride right? That just leaves us with WidgetsApp.debugShowWidgetInspectorOverrideNotifier.addListener. The old version was testing this indirectly via service.rebuildCount. Any reason we can't continue to do that and keep the Notifier private? If we can't do that, we could at least lock down the public type of the debugShowWidgetInspectorOverrideNotifier to something like Listenable so it doesn't expose more API surface then necessary.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was able to overcome this by grabbing the Listenable from the ValueListenableBuilder, instead of exposing it in WidgetsApp :D Let me know what you think :D

@goderbauer goderbauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

This looks great! 🎉

Comment thread packages/flutter/test/widgets/widget_inspector_test.dart Outdated
@CoderDake
CoderDake merged commit ac095ed into flutter:master Oct 13, 2023
@CoderDake
CoderDake deleted the no-force-rebuild branch October 13, 2023 21:08
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 14, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 14, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 15, 2023
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Oct 15, 2023
Roll Flutter from 3865e49 to b00216b (34 revisions)

flutter/flutter@3865e49...b00216b

2023-10-15 [email protected] Roll Flutter Engine from e2319935d8c8 to f8eb68b115f1 (1 revision) (flutter/flutter#136605)
2023-10-15 [email protected] Roll Flutter Engine from edf688d30ae3 to e2319935d8c8 (1 revision) (flutter/flutter#136604)
2023-10-15 [email protected] Roll Flutter Engine from 1b3bf985490c to edf688d30ae3 (1 revision) (flutter/flutter#136603)
2023-10-15 [email protected] Roll Flutter Engine from e4f8b2267906 to 1b3bf985490c (1 revision) (flutter/flutter#136601)
2023-10-15 [email protected] Roll Flutter Engine from b64ebc0be62d to e4f8b2267906 (1 revision) (flutter/flutter#136599)
2023-10-15 [email protected] Roll Flutter Engine from 529eb423604c to b64ebc0be62d (1 revision) (flutter/flutter#136592)
2023-10-14 [email protected] Roll Flutter Engine from 82596277bd2b to 529eb423604c (1 revision) (flutter/flutter#136591)
2023-10-14 [email protected] Roll Flutter Engine from 015e352a174e to 82596277bd2b (1 revision) (flutter/flutter#136590)
2023-10-14 [email protected] Roll Flutter Engine from 73acf62a2fe1 to 015e352a174e (1 revision) (flutter/flutter#136589)
2023-10-14 [email protected] Upload GPU frame times for Impeller on Android/iOS. (flutter/flutter#136565)
2023-10-14 [email protected] Roll Flutter Engine from c777aae5ca15 to 73acf62a2fe1 (1 revision) (flutter/flutter#136581)
2023-10-14 [email protected] Roll Flutter Engine from d4e765fbefb8 to c777aae5ca15 (1 revision) (flutter/flutter#136580)
2023-10-14 [email protected] Roll Flutter Engine from 472be42e90e0 to d4e765fbefb8 (1 revision) (flutter/flutter#136578)
2023-10-14 [email protected] Roll Flutter Engine from 9149a427ef98 to 472be42e90e0 (1 revision) (flutter/flutter#136574)
2023-10-14 [email protected] _RouterState should dispose created _RestorableRouteInformation. (flutter/flutter#136556)
2023-10-14 [email protected] Roll Flutter Engine from cd1a5ed6f961 to 9149a427ef98 (1 revision) (flutter/flutter#136571)
2023-10-14 [email protected] increase windows build test sharding, revert timeout 30 mins (flutter/flutter#136474)
2023-10-14 [email protected] Roll Flutter Engine from a4e62581525c to cd1a5ed6f961 (2 revisions) (flutter/flutter#136566)
2023-10-14 [email protected] Change some usage of RawKeyEvent to KeyEvent in preparation for deprecation (flutter/flutter#136420)
2023-10-13 [email protected] Manual roll Flutter Engine from 6605151b4d0a to a4e62581525c (9 revisions) (flutter/flutter#136564)
2023-10-13 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 2.22.0 to 2.22.3 (flutter/flutter#136563)
2023-10-13 [email protected] [Impeller] GPU frame timings summarization. (flutter/flutter#136408)
2023-10-13 [email protected] Changes WidgetInspector to use valuenotifier instead of a force rebuild for (flutter/flutter#131634)
2023-10-13 [email protected] Roll Flutter Engine from 799e8de11c12 to 6605151b4d0a (3 revisions) (flutter/flutter#136558)
2023-10-13 [email protected] Roll Flutter Engine from 93f02f7237db to 799e8de11c12 (6 revisions) (flutter/flutter#136553)
2023-10-13 [email protected] Mark leak in NativeCodec.getNextFrame. (flutter/flutter#136514)
2023-10-13 [email protected] Stop skipping leaks in the test.  (flutter/flutter#136512)
2023-10-13 [email protected] run tests under dev/tools as part of framework-misc and get them passing (flutter/flutter#136501)
2023-10-13 [email protected] Roll Flutter Engine from 60968c892649 to 93f02f7237db (5 revisions) (flutter/flutter#136546)
2023-10-13 [email protected] Remove bringup from tests and move some back to presubmit. Reorganize TESTOWNERS. (flutter/flutter#136498)
2023-10-13 [email protected] [leak-tracking] Add leak tracking in test/rendering -2 (flutter/flutter#136310)
2023-10-13 [email protected] [leak-tracking] Add leak tracking in test/rendering -3 (flutter/flutter#136308)
2023-10-13 [email protected] Roll Packages from 93c3f69 to fd84e65 (3 revisions) (flutter/flutter#136538)
2023-10-13 [email protected] Roll Flutter Engine from f9aed0267352 to 60968c892649 (1 revision) (flutter/flutter#136539)

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

...
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
Roll Flutter from 3865e49 to b00216b (34 revisions)

flutter/flutter@3865e49...b00216b

2023-10-15 [email protected] Roll Flutter Engine from e2319935d8c8 to f8eb68b115f1 (1 revision) (flutter/flutter#136605)
2023-10-15 [email protected] Roll Flutter Engine from edf688d30ae3 to e2319935d8c8 (1 revision) (flutter/flutter#136604)
2023-10-15 [email protected] Roll Flutter Engine from 1b3bf985490c to edf688d30ae3 (1 revision) (flutter/flutter#136603)
2023-10-15 [email protected] Roll Flutter Engine from e4f8b2267906 to 1b3bf985490c (1 revision) (flutter/flutter#136601)
2023-10-15 [email protected] Roll Flutter Engine from b64ebc0be62d to e4f8b2267906 (1 revision) (flutter/flutter#136599)
2023-10-15 [email protected] Roll Flutter Engine from 529eb423604c to b64ebc0be62d (1 revision) (flutter/flutter#136592)
2023-10-14 [email protected] Roll Flutter Engine from 82596277bd2b to 529eb423604c (1 revision) (flutter/flutter#136591)
2023-10-14 [email protected] Roll Flutter Engine from 015e352a174e to 82596277bd2b (1 revision) (flutter/flutter#136590)
2023-10-14 [email protected] Roll Flutter Engine from 73acf62a2fe1 to 015e352a174e (1 revision) (flutter/flutter#136589)
2023-10-14 [email protected] Upload GPU frame times for Impeller on Android/iOS. (flutter/flutter#136565)
2023-10-14 [email protected] Roll Flutter Engine from c777aae5ca15 to 73acf62a2fe1 (1 revision) (flutter/flutter#136581)
2023-10-14 [email protected] Roll Flutter Engine from d4e765fbefb8 to c777aae5ca15 (1 revision) (flutter/flutter#136580)
2023-10-14 [email protected] Roll Flutter Engine from 472be42e90e0 to d4e765fbefb8 (1 revision) (flutter/flutter#136578)
2023-10-14 [email protected] Roll Flutter Engine from 9149a427ef98 to 472be42e90e0 (1 revision) (flutter/flutter#136574)
2023-10-14 [email protected] _RouterState should dispose created _RestorableRouteInformation. (flutter/flutter#136556)
2023-10-14 [email protected] Roll Flutter Engine from cd1a5ed6f961 to 9149a427ef98 (1 revision) (flutter/flutter#136571)
2023-10-14 [email protected] increase windows build test sharding, revert timeout 30 mins (flutter/flutter#136474)
2023-10-14 [email protected] Roll Flutter Engine from a4e62581525c to cd1a5ed6f961 (2 revisions) (flutter/flutter#136566)
2023-10-14 [email protected] Change some usage of RawKeyEvent to KeyEvent in preparation for deprecation (flutter/flutter#136420)
2023-10-13 [email protected] Manual roll Flutter Engine from 6605151b4d0a to a4e62581525c (9 revisions) (flutter/flutter#136564)
2023-10-13 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 2.22.0 to 2.22.3 (flutter/flutter#136563)
2023-10-13 [email protected] [Impeller] GPU frame timings summarization. (flutter/flutter#136408)
2023-10-13 [email protected] Changes WidgetInspector to use valuenotifier instead of a force rebuild for (flutter/flutter#131634)
2023-10-13 [email protected] Roll Flutter Engine from 799e8de11c12 to 6605151b4d0a (3 revisions) (flutter/flutter#136558)
2023-10-13 [email protected] Roll Flutter Engine from 93f02f7237db to 799e8de11c12 (6 revisions) (flutter/flutter#136553)
2023-10-13 [email protected] Mark leak in NativeCodec.getNextFrame. (flutter/flutter#136514)
2023-10-13 [email protected] Stop skipping leaks in the test.  (flutter/flutter#136512)
2023-10-13 [email protected] run tests under dev/tools as part of framework-misc and get them passing (flutter/flutter#136501)
2023-10-13 [email protected] Roll Flutter Engine from 60968c892649 to 93f02f7237db (5 revisions) (flutter/flutter#136546)
2023-10-13 [email protected] Remove bringup from tests and move some back to presubmit. Reorganize TESTOWNERS. (flutter/flutter#136498)
2023-10-13 [email protected] [leak-tracking] Add leak tracking in test/rendering -2 (flutter/flutter#136310)
2023-10-13 [email protected] [leak-tracking] Add leak tracking in test/rendering -3 (flutter/flutter#136308)
2023-10-13 [email protected] Roll Packages from 93c3f69 to fd84e65 (3 revisions) (flutter/flutter#136538)
2023-10-13 [email protected] Roll Flutter Engine from f9aed0267352 to 60968c892649 (1 revision) (flutter/flutter#136539)

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

...
bisor0627 pushed a commit to bisor0627/packages that referenced this pull request Jun 19, 2026
Roll Flutter from 3865e49 to b00216b (34 revisions)

flutter/flutter@3865e49...b00216b

2023-10-15 [email protected] Roll Flutter Engine from e2319935d8c8 to f8eb68b115f1 (1 revision) (flutter/flutter#136605)
2023-10-15 [email protected] Roll Flutter Engine from edf688d30ae3 to e2319935d8c8 (1 revision) (flutter/flutter#136604)
2023-10-15 [email protected] Roll Flutter Engine from 1b3bf985490c to edf688d30ae3 (1 revision) (flutter/flutter#136603)
2023-10-15 [email protected] Roll Flutter Engine from e4f8b2267906 to 1b3bf985490c (1 revision) (flutter/flutter#136601)
2023-10-15 [email protected] Roll Flutter Engine from b64ebc0be62d to e4f8b2267906 (1 revision) (flutter/flutter#136599)
2023-10-15 [email protected] Roll Flutter Engine from 529eb423604c to b64ebc0be62d (1 revision) (flutter/flutter#136592)
2023-10-14 [email protected] Roll Flutter Engine from 82596277bd2b to 529eb423604c (1 revision) (flutter/flutter#136591)
2023-10-14 [email protected] Roll Flutter Engine from 015e352a174e to 82596277bd2b (1 revision) (flutter/flutter#136590)
2023-10-14 [email protected] Roll Flutter Engine from 73acf62a2fe1 to 015e352a174e (1 revision) (flutter/flutter#136589)
2023-10-14 [email protected] Upload GPU frame times for Impeller on Android/iOS. (flutter/flutter#136565)
2023-10-14 [email protected] Roll Flutter Engine from c777aae5ca15 to 73acf62a2fe1 (1 revision) (flutter/flutter#136581)
2023-10-14 [email protected] Roll Flutter Engine from d4e765fbefb8 to c777aae5ca15 (1 revision) (flutter/flutter#136580)
2023-10-14 [email protected] Roll Flutter Engine from 472be42e90e0 to d4e765fbefb8 (1 revision) (flutter/flutter#136578)
2023-10-14 [email protected] Roll Flutter Engine from 9149a427ef98 to 472be42e90e0 (1 revision) (flutter/flutter#136574)
2023-10-14 [email protected] _RouterState should dispose created _RestorableRouteInformation. (flutter/flutter#136556)
2023-10-14 [email protected] Roll Flutter Engine from cd1a5ed6f961 to 9149a427ef98 (1 revision) (flutter/flutter#136571)
2023-10-14 [email protected] increase windows build test sharding, revert timeout 30 mins (flutter/flutter#136474)
2023-10-14 [email protected] Roll Flutter Engine from a4e62581525c to cd1a5ed6f961 (2 revisions) (flutter/flutter#136566)
2023-10-14 [email protected] Change some usage of RawKeyEvent to KeyEvent in preparation for deprecation (flutter/flutter#136420)
2023-10-13 [email protected] Manual roll Flutter Engine from 6605151b4d0a to a4e62581525c (9 revisions) (flutter/flutter#136564)
2023-10-13 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 2.22.0 to 2.22.3 (flutter/flutter#136563)
2023-10-13 [email protected] [Impeller] GPU frame timings summarization. (flutter/flutter#136408)
2023-10-13 [email protected] Changes WidgetInspector to use valuenotifier instead of a force rebuild for (flutter/flutter#131634)
2023-10-13 [email protected] Roll Flutter Engine from 799e8de11c12 to 6605151b4d0a (3 revisions) (flutter/flutter#136558)
2023-10-13 [email protected] Roll Flutter Engine from 93f02f7237db to 799e8de11c12 (6 revisions) (flutter/flutter#136553)
2023-10-13 [email protected] Mark leak in NativeCodec.getNextFrame. (flutter/flutter#136514)
2023-10-13 [email protected] Stop skipping leaks in the test.  (flutter/flutter#136512)
2023-10-13 [email protected] run tests under dev/tools as part of framework-misc and get them passing (flutter/flutter#136501)
2023-10-13 [email protected] Roll Flutter Engine from 60968c892649 to 93f02f7237db (5 revisions) (flutter/flutter#136546)
2023-10-13 [email protected] Remove bringup from tests and move some back to presubmit. Reorganize TESTOWNERS. (flutter/flutter#136498)
2023-10-13 [email protected] [leak-tracking] Add leak tracking in test/rendering -2 (flutter/flutter#136310)
2023-10-13 [email protected] [leak-tracking] Add leak tracking in test/rendering -3 (flutter/flutter#136308)
2023-10-13 [email protected] Roll Packages from 06be4b3 to 9caa356 (3 revisions) (flutter/flutter#136538)
2023-10-13 [email protected] Roll Flutter Engine from f9aed0267352 to 60968c892649 (1 revision) (flutter/flutter#136539)

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

...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: tech-debt Technical debt, code quality, testing, etc. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

toggling the inspector overlay on and off currently triggers a reassemble of the app

3 participants