devtools icon indicating copy to clipboard operation
devtools copied to clipboard

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

Open elliette opened this issue 8 months ago • 4 comments

Currently when you run your app in profile-mode, the performance panel shows a disabled checkbox that makes it seem like it should be possible to "count widget builds" (see screenshot below)

In actuality, "count widget builds" relies on the trackRebuildDirtyWidgets service extension, which uses debugOnRebuildDirtyWidget. This is only available in debug-mode: https://github.com/flutter/flutter/blob/f9e809913240552c391bf31b1cfdbdf410224d8c/packages/flutter/lib/src/widgets/debug.dart#L59

Instead of "To see widget rebuilds for Flutter frames, enable CountWidgetRebuilds", we should remove the checkbox and update the text to say "Rebuild information not available for this frame. Widget rebuild counts are only available when running an app in debug-mode."

Image

elliette avatar Mar 19 '26 22:03 elliette

Hi, I'd like to take this one.

I think the issue is the Performance panel shows a disabled "Count widget builds" checkbox in profile-mode with no explanation of why it's disabled, when in fact this feature relies on trackRebuildDirtyWidgets / debugOnRebuildDirtyWidget which are only available in debug-mode.

My plan is to remove the disabled checkbox and update the text to say "Rebuild information not available for this frame. Widget rebuild counts are only available when running an app in debug-mode." as suggested in the issue.

Please let me know if you'd prefer a different approach.

Bingtagui404 avatar Mar 20 '26 01:03 Bingtagui404

Sorry, I won't be able to work on this due to personal reasons. Feel free to reassign it to someone else.

Bingtagui404 avatar Mar 20 '26 15:03 Bingtagui404

I've submitted a PR to fix this:

After reviewing the previous PR by @Bingtagui404 (#9733), I noticed it was missing the test for profile mode that @elliette requested. My PR includes:

  • The same UI fix (profile mode detection + clear message)
  • Keeps the existing code comment that was incorrectly removed
  • Adds widget tests for both profile mode and debug mode behavior

crackedhandle avatar Apr 03 '26 00:04 crackedhandle

I'd like to take this one — will update the frame analysis UI so profile-mode no longer shows a disabled Count widget builds checkbox, and instead explain that rebuild counts are debug-mode only.

enesbugrahankilic avatar Aug 30 '26 18:08 enesbugrahankilic