From ccb63dcc880db8f06940d075b81417d21ddee68f Mon Sep 17 00:00:00 2001 From: Baixiaochun <182930459+Bingtagui404@users.noreply.github.com> Date: Fri, 20 Mar 2026 10:46:24 +0800 Subject: [PATCH] Specify that widget rebuilds is only available in debug-mode When running an app in profile-mode, the Performance panel previously showed a disabled "Count widget builds" checkbox without explaining why it was disabled. This change checks whether the connected app is a profile build using `isProfileBuildNow`. When it is, the checkbox and clear button are removed and replaced with a message explaining that widget rebuild counts are only available in debug-mode. Fixes https://github.com/flutter/devtools/issues/9730 --- .../panes/rebuild_stats/rebuild_stats.dart | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/devtools_app/lib/src/screens/performance/panes/rebuild_stats/rebuild_stats.dart b/packages/devtools_app/lib/src/screens/performance/panes/rebuild_stats/rebuild_stats.dart index a19d2502276..16b817aa65b 100644 --- a/packages/devtools_app/lib/src/screens/performance/panes/rebuild_stats/rebuild_stats.dart +++ b/packages/devtools_app/lib/src/screens/performance/panes/rebuild_stats/rebuild_stats.dart @@ -92,6 +92,19 @@ class _RebuildStatsViewState extends State @override Widget build(BuildContext context) { + final isProfileBuild = + serviceConnection.serviceManager.connectedApp?.isProfileBuildNow ?? + false; + if (isProfileBuild) { + return const Center( + child: Text( + 'Rebuild information is not available for this frame.\n' + 'Widget rebuild counts are only available when running ' + 'an app in debug-mode.', + textAlign: TextAlign.center, + ), + ); + } return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -138,7 +151,7 @@ class _RebuildStatsViewState extends State if (metrics.isEmpty) { return const Center( child: Text('Interact with the app to trigger rebuilds.'), - ); // No data to display but there should be data soon. + ); } return RebuildTable( key: const Key('Rebuild Table'),