close
Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,19 @@ class _RebuildStatsViewState extends State<RebuildStatsView>

@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: [
Expand Down
23 changes: 9 additions & 14 deletions packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Copyright 2025 The Flutter Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
-->

This is a draft for future release notes that are going to land on
[the Flutter website](https://docs.flutter.dev/tools/devtools/release-notes).

Expand All @@ -11,20 +12,20 @@ This is a draft for future release notes that are going to land on
The 2.58.0 release of the Dart and Flutter DevTools
includes the following changes among other general improvements.
To learn more about DevTools, check out the
[DevTools overview](/tools/devtools).
[DevTools overview](https://docs.flutter.dev/tools/devtools).

## General updates

TODO: Remove this section if there are not any updates.

## Inspector updates

- Deleted the option to use the legacy inspector.
[#9782](https://github.com/flutter/devtools/pull/9782)
TODO: Remove this section if there are not any updates.

## Performance updates

TODO: Remove this section if there are not any updates.
- Show a message in the Performance panel when widget rebuild tracking is
unavailable because the app is running in profile mode. [#9755](https://github.com/flutter/devtools/pull/9755)

## CPU profiler updates

Expand All @@ -40,25 +41,19 @@ TODO: Remove this section if there are not any updates.

## Network profiler updates

- Added response size column to the Network tab and displayed response size in the request inspector overview.
[#9744](https://github.com/flutter/devtools/pull/9744)

- Improved HTTP request status classification in the Network tab to better distinguish cancelled, completed, and in-flight requests (for example, avoiding some cases where cancelled requests appeared as pending). [#9683](https://github.com/flutter/devtools/pull/9683)
TODO: Remove this section if there are not any updates.

- Added a filter setting to hide HTTP-profiler socket data.
[#9698](https://github.com/flutter/devtools/pull/9698)

## Logging updates

- Fixed an issue where log messages containing newline characters were incorrectly split into multiple separate entries in the Logging screen. [#9757](https://github.com/flutter/devtools/pull/9757)
TODO: Remove this section if there are not any updates.

## App size tool updates

TODO: Remove this section if there are not any updates.

## Deep links tool updates

- Pluralized "domain" and "path" in the validation summary notification titles when multiple errors are present. [#9790](https://github.com/flutter/devtools/pull/9790)
TODO: Remove this section if there are not any updates.

## VS Code sidebar updates

Expand All @@ -75,4 +70,4 @@ TODO: Remove this section if there are not any updates.
## Full commit history

To find a complete list of changes in this release, check out the
[DevTools git log](https://github.com/flutter/devtools/tree/v2.58.0).
[DevTools git log](https://github.com/flutter/devtools/tree/v2.58.0).
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'dart:async';

import 'package:devtools_app/devtools_app.dart';
import 'package:devtools_app/src/screens/performance/panes/controls/performance_controls.dart';
import 'package:devtools_app/src/screens/performance/panes/rebuild_stats/rebuild_stats.dart';
import 'package:devtools_app/src/screens/performance/panes/timeline_events/timeline_events_view.dart';
import 'package:devtools_app/src/screens/performance/tabbed_performance_view.dart';
import 'package:devtools_app/src/shared/feature_flags.dart';
Expand Down Expand Up @@ -218,7 +219,6 @@ void main() {
await tester.runAsync(() async {
await pumpPerformanceScreen(tester, runAsync: true);
await tester.pumpAndSettle();

final chartButtonFinder = find.byType(VisibilityButton);
expect(chartButtonFinder, findsOneWidget);

Expand All @@ -231,7 +231,6 @@ void main() {

await tester.tap(chartButtonFinder);
await tester.pumpAndSettle();

// The flutter frames chart should no longer be visible.
expect(find.byType(FramesChartControls), findsNothing);
expect(
Expand All @@ -252,46 +251,6 @@ void main() {
},
);

// testWidgetsWithWindowSize(
// 'clears timeline on clear',
// windowSize,
// (WidgetTester tester) async {
// await tester.runAsync(() async {
// await pumpPerformanceScreen(tester, runAsync: true);
// await tester.pumpAndSettle();

// // Ensure the Timeline Events tab is selected.
// final timelineEventsTabFinder = find.text('Timeline Events');
// expect(timelineEventsTabFinder, findsOneWidget);
// await tester.tap(timelineEventsTabFinder);
// await tester.pumpAndSettle();

// expect(
// controller.timelineEventsController.allTraceEvents,
// isNotEmpty,
// );
// expect(find.byType(FlutterFramesChart), findsOneWidget);
// expect(find.byType(TimelineFlameChart), findsOneWidget);
// expect(
// find.byKey(TimelineEventsView.emptyTimelineKey),
// findsNothing,
// );
// expect(find.byType(EventDetails), findsOneWidget);

// await tester.tap(find.byIcon(Icons.block));
// await tester.pumpAndSettle();
// expect(controller.timelineEventsController.allTraceEvents, isEmpty);
// expect(find.byType(FlutterFramesChart), findsOneWidget);
// expect(find.byType(TimelineFlameChart), findsNothing);
// expect(
// find.byKey(TimelineEventsView.emptyTimelineKey),
// findsOneWidget,
// );
// expect(find.byType(EventDetails), findsNothing);
// });
// },
// );

testWidgetsWithWindowSize('opens enhance tracing overlay', windowSize, (
WidgetTester tester,
) async {
Expand Down Expand Up @@ -395,6 +354,69 @@ void main() {
},
);
});

group('RebuildStatsView', () {
late FakeServiceConnectionManager fakeServiceConnection;
late RebuildCountModel model;
late ValueNotifier<FlutterFrame?> selectedFrame;

setUp(() {
fakeServiceConnection = FakeServiceConnectionManager();
final app = fakeServiceConnection.serviceManager.connectedApp!;
when(app.initialized).thenReturn(Completer()..complete(true));
when(app.isDartWebAppNow).thenReturn(false);
when(app.isFlutterAppNow).thenReturn(true);
when(app.isDartCliAppNow).thenReturn(false);
when(app.isDartWebApp).thenAnswer((_) async => false);
when(app.isProfileBuild).thenAnswer((_) async => false);
setGlobal(ServiceConnectionManager, fakeServiceConnection);
setGlobal(IdeTheme, IdeTheme());
setGlobal(NotificationService, NotificationService());
setGlobal(BannerMessagesController, BannerMessagesController());
setGlobal(PreferencesController, PreferencesController());
setGlobal(OfflineDataController, OfflineDataController());
model = RebuildCountModel();
selectedFrame = ValueNotifier<FlutterFrame?>(null);
});

testWidgets('shows message when running in profile mode', (
WidgetTester tester,
) async {
final app = fakeServiceConnection.serviceManager.connectedApp!;
when(app.isProfileBuildNow).thenReturn(true);

await tester.pumpWidget(
wrapWithControllers(
RebuildStatsView(model: model, selectedFrame: selectedFrame),
),
);
await tester.pump();

expect(
find.textContaining('Widget rebuild counts are only available'),
findsOneWidget,
);
});

testWidgets('shows normal UI when running in debug mode', (
WidgetTester tester,
) async {
final app = fakeServiceConnection.serviceManager.connectedApp!;
when(app.isProfileBuildNow).thenReturn(false);

await tester.pumpWidget(
wrapWithControllers(
RebuildStatsView(model: model, selectedFrame: selectedFrame),
),
);
await tester.pump();

expect(
find.textContaining('Widget rebuild counts are only available'),
findsNothing,
);
});
});
});
}

Expand Down
Loading