Skip to content

Show debug-mode message for widget rebuilds in profile mode#9755

Open
crackedhandle wants to merge 14 commits intoflutter:masterfrom
crackedhandle:fix-widget-rebuilds-profile-mode
Open

Show debug-mode message for widget rebuilds in profile mode#9755
crackedhandle wants to merge 14 commits intoflutter:masterfrom
crackedhandle:fix-widget-rebuilds-profile-mode

Conversation

@crackedhandle
Copy link
Copy Markdown

Fixes #9730

Problem

When running in profile mode, the Performance panel showed a
disabled "Count widget builds" checkbox which was misleading -
it implies the feature could work if enabled. In reality, widget
rebuild counts rely on debugOnRebuildDirtyWidget which is only
available in debug mode.

Solution

  • Removes the checkbox when running in profile mode
  • Replaces it with a clear message:

    "Rebuild information is not available for this frame.
    Widget rebuild counts are only available when running
    an app in debug-mode."

Tests

Added rebuild_stats_view_test.dart with two widget tests:

  • Verifies the message appears in profile mode
  • Verifies the normal UI appears in debug mode

When running in profile mode, the Performance panel showed a
disabled 'Count widget builds' checkbox which was misleading.
Widget rebuild counts rely on debugOnRebuildDirtyWidget which
is only available in debug mode.

This change:
- Removes the checkbox when running in profile mode
- Shows a clear message: 'Rebuild information is not available
  for this frame. Widget rebuild counts are only available when
  running an app in debug-mode.'
- Adds widget tests for both profile mode and debug mode behavior

Fixes flutter#9730
@crackedhandle
Copy link
Copy Markdown
Author

@elliette can you review this?

selectedFrame = ValueNotifier<FlutterFrame?>(null);
});

testWidgets(
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.

Could we add these tests cases to the performance_screen_test instead of creating a new test suite? Thanks!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

sure!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Please review the required changes @elliette ! thanks

Per reviewer feedback, moved the profile mode widget tests from a
separate test file into the existing performance_screen_test.dart.
Also added required imports for RebuildStatsView, RebuildCountModel,
FlutterFrame and foundation.
@crackedhandle crackedhandle requested a review from elliette April 10, 2026 11:18
@crackedhandle crackedhandle requested a review from a team as a code owner April 14, 2026 16:52
Comment thread packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md
Comment thread packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md
Comment thread packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md Outdated
Comment thread packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md Outdated
@crackedhandle crackedhandle requested a review from srawlins April 14, 2026 18:35
@crackedhandle crackedhandle requested a review from srawlins April 16, 2026 07:28
Comment thread packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md Outdated
Comment thread packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md Outdated
Updated the release notes for DevTools 2.58.0 with a new link format.
Comment thread packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md Outdated
## Performance updates

TODO: Remove this section if there are not any updates.
- Show a message in the Performance panel when widget rebuild tracking is
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.

Release notes should be in past tense (e.g. "Added a message...")

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added the missing period and updated the release note to past tense. Thanks for the review. I really appreciate the attention to detail and I’m learning a lot from this process. Please let me know if any further changes are needed.

Updated release notes for version 2.58.0 to reflect changes in the Performance panel and formatting corrections.
@crackedhandle crackedhandle requested a review from elliette April 16, 2026 19:42
@crackedhandle
Copy link
Copy Markdown
Author

I see CI is failing due to lint warnings in DevTools files that I haven’t modified. Should I address these as part of this PR, or is there a preferred way to handle them? @srawlins

@srawlins
Copy link
Copy Markdown
Contributor

I think those are the result of a new version of analyzer... or Dart... or even DCM I guess. So we just have to fix them out-of-band. Probably someone should fix them and land that fix before landing other PRs.

@crackedhandle
Copy link
Copy Markdown
Author

I think those are the result of a new version of analyzer... or Dart... or even DCM I guess. So we just have to fix them out-of-band. Probably someone should fix them and land that fix before landing other PRs.

Got it, thanks for the clarification. I’ll wait for the lint fixes to land and re-run CI afterward.

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.

Specify that widget rebuilds is only available when running in debug-mode

3 participants