Remove unused code under `screens/` (#9911)
* Add check-unused-code to DCM CI checks.
* exclude public API
* Add excludes
* exclude test/
* exclude service/
* exclude integration_test/
* Ignore false positives in app.dart.
* Remove unused code in extensions/ and framework/
* use if (kDebugMode)
* remove other assert
* Remove unused code from `screens/`
* fix test
* Fix bug and format.
diff --git a/analysis_options.yaml b/analysis_options.yaml
index e57f4c2..070a4f5 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -164,7 +164,8 @@
# TODO(https://github.com/flutter/devtools/issues/9906) remove these
# excludes as findings are resolved.
- integration_test/**
- - lib/src/screens/**
+ # Investigate internal usages of inspector_controller before removing.
+ - lib/src/screens/inspector/**_controller.dart
- lib/src/service/**
- lib/src/shared/**
- lib/src/standalone_ui/**
diff --git a/packages/devtools_app/lib/src/screens/accessibility/accessibility_screen.dart b/packages/devtools_app/lib/src/screens/accessibility/accessibility_screen.dart
index fc38754..2134b20 100644
--- a/packages/devtools_app/lib/src/screens/accessibility/accessibility_screen.dart
+++ b/packages/devtools_app/lib/src/screens/accessibility/accessibility_screen.dart
@@ -19,8 +19,6 @@
class AccessibilityScreen extends Screen {
AccessibilityScreen() : super.fromMetaData(ScreenMetaData.accessibility);
- static final id = ScreenMetaData.accessibility.id;
-
@override
Widget buildScreenBody(BuildContext context) =>
const AccessibilityScreenBody();
@@ -36,11 +34,13 @@
class _AccessibilityScreenBodyState extends State<AccessibilityScreenBody>
with AutoDisposeMixin {
+ // ignore: unused-code, temporarily ignore since this screen is under active development.
late AccessibilityController controller;
@override
void initState() {
super.initState();
+ // ignore: unused-code, temporarily ignore since this screen is under active development.
controller = screenControllers.lookup<AccessibilityController>();
}
diff --git a/packages/devtools_app/lib/src/screens/app_size/app_size_screen.dart b/packages/devtools_app/lib/src/screens/app_size/app_size_screen.dart
index ff9deef..f328979 100644
--- a/packages/devtools_app/lib/src/screens/app_size/app_size_screen.dart
+++ b/packages/devtools_app/lib/src/screens/app_size/app_size_screen.dart
@@ -292,6 +292,7 @@
height: defaultButtonHeight,
child: RoundedDropDownButton<DiffTreeType>(
key: AppSizeScreen.diffTypeDropdownKey,
+ value: value,
isDense: true,
items: [
_buildDiffTreeTypeMenuItem(DiffTreeType.combined),
diff --git a/packages/devtools_app/lib/src/screens/debugger/breakpoint_manager.dart b/packages/devtools_app/lib/src/screens/debugger/breakpoint_manager.dart
index 646fffa..b8207bc 100644
--- a/packages/devtools_app/lib/src/screens/debugger/breakpoint_manager.dart
+++ b/packages/devtools_app/lib/src/screens/debugger/breakpoint_manager.dart
@@ -23,7 +23,6 @@
final _breakPositionsMap = <String, List<SourcePosition>>{};
- ValueListenable<List<Breakpoint>> get breakpoints => _breakpoints;
final _breakpoints = ValueNotifier<List<Breakpoint>>([]);
ValueListenable<List<BreakpointAndSourcePosition>>
diff --git a/packages/devtools_app/lib/src/screens/debugger/codeview_controller.dart b/packages/devtools_app/lib/src/screens/debugger/codeview_controller.dart
index befe39d..8f7abe4 100644
--- a/packages/devtools_app/lib/src/screens/debugger/codeview_controller.dart
+++ b/packages/devtools_app/lib/src/screens/debugger/codeview_controller.dart
@@ -533,6 +533,7 @@
DevToolsNavigationState state,
) : super(kind: type, state: state.state);
+ @visibleForTesting
static CodeViewSourceLocationNavigationState? fromState(
DevToolsNavigationState? state,
) {
diff --git a/packages/devtools_app/lib/src/screens/debugger/span_parser.dart b/packages/devtools_app/lib/src/screens/debugger/span_parser.dart
index 69c96c4..74cbe01 100644
--- a/packages/devtools_app/lib/src/screens/debugger/span_parser.dart
+++ b/packages/devtools_app/lib/src/screens/debugger/span_parser.dart
@@ -589,19 +589,6 @@
/// Location where the next produced span should begin.
ScopeStackLocation _nextLocation = ScopeStackLocation.zero;
- /// Adds a scope for a given region.
- ///
- /// This method is the same as calling [push] and then [pop] with the same
- /// args.
- void add(
- String? scope, {
- required ScopeStackLocation start,
- required ScopeStackLocation end,
- }) {
- push(scope, start);
- pop(scope, end);
- }
-
/// Pushes a new scope onto the stack starting at [location].
void push(String? scope, ScopeStackLocation location) {
if (scope == null) return;
@@ -721,6 +708,8 @@
ScopeStackItem(this.scope, this.location);
final String scope;
+
+ // ignore: unused-code, foundational to this data class.
final ScopeStackLocation location;
}
diff --git a/packages/devtools_app/lib/src/screens/debugger/syntax_highlighter.dart b/packages/devtools_app/lib/src/screens/debugger/syntax_highlighter.dart
index 4899a83..82d2c78 100644
--- a/packages/devtools_app/lib/src/screens/debugger/syntax_highlighter.dart
+++ b/packages/devtools_app/lib/src/screens/debugger/syntax_highlighter.dart
@@ -18,6 +18,7 @@
class SyntaxHighlighter {
SyntaxHighlighter({String? source}) : source = source ?? '';
+ @visibleForTesting
SyntaxHighlighter.withGrammar({Grammar? grammar, String? source})
: source = source ?? '' {
_grammar = grammar;
diff --git a/packages/devtools_app/lib/src/screens/deep_link_validation/deep_link_list_view.dart b/packages/devtools_app/lib/src/screens/deep_link_validation/deep_link_list_view.dart
index 75a9084..30ef0e5 100644
--- a/packages/devtools_app/lib/src/screens/deep_link_validation/deep_link_list_view.dart
+++ b/packages/devtools_app/lib/src/screens/deep_link_validation/deep_link_list_view.dart
@@ -33,13 +33,12 @@
}
class _DeepLinkListViewState extends State<DeepLinkListView> {
- late DeepLinksController controller;
-
@override
void initState() {
super.initState();
- controller = screenControllers.lookup<DeepLinksController>()
- ..firstLoadWithDefaultConfigurations();
+ screenControllers
+ .lookup<DeepLinksController>()
+ .firstLoadWithDefaultConfigurations();
}
@override
diff --git a/packages/devtools_app/lib/src/screens/deep_link_validation/deep_links_model.dart b/packages/devtools_app/lib/src/screens/deep_link_validation/deep_links_model.dart
index feaed09..7d035f1 100644
--- a/packages/devtools_app/lib/src/screens/deep_link_validation/deep_links_model.dart
+++ b/packages/devtools_app/lib/src/screens/deep_link_validation/deep_links_model.dart
@@ -219,14 +219,6 @@
),
);
- static final defaultsCaseSensitiveFormat = AASAfileFormatSubCheck(
- 'Applinks defaults case sensitive format',
- propertyTypeMessage(
- property: 'applinks.defaults.caseSensitive',
- expectedType: 'boolean',
- ),
- );
-
static const detailsFormat = AASAfileFormatSubCheck(
'Applinks details format',
'This test checks that the `applinks.details` property is formatted properly. Ref - '
@@ -402,6 +394,7 @@
final String path;
// TODO(hangyujin): display queryParams in path table.
+ // ignore: unused-code, outstanding TODO.
final Map<String, String> queryParams;
/// A Boolean value that indicates whether to stop pattern matching and prevent the universal
diff --git a/packages/devtools_app/lib/src/screens/deep_link_validation/deep_links_screen.dart b/packages/devtools_app/lib/src/screens/deep_link_validation/deep_links_screen.dart
index 0752039..a541109 100644
--- a/packages/devtools_app/lib/src/screens/deep_link_validation/deep_links_screen.dart
+++ b/packages/devtools_app/lib/src/screens/deep_link_validation/deep_links_screen.dart
@@ -18,9 +18,8 @@
static final id = ScreenMetaData.deepLinks.id;
- // TODO(https://github.com/flutter/devtools/issues/6013): write documentation.
- // @override
- // String get docPageId => id;
+ @override
+ String get docPageId => id;
@override
String get docsUrl => 'https://flutter.dev/to/deep-link-tool';
diff --git a/packages/devtools_app/lib/src/screens/deep_link_validation/deep_links_services.dart b/packages/devtools_app/lib/src/screens/deep_link_validation/deep_links_services.dart
index b260c74..e16accc 100644
--- a/packages/devtools_app/lib/src/screens/deep_link_validation/deep_links_services.dart
+++ b/packages/devtools_app/lib/src/screens/deep_link_validation/deep_links_services.dart
@@ -109,6 +109,7 @@
class ValidateIosDomainResult {
ValidateIosDomainResult(this.errorCode, this.domainErrors, this.paths);
+ // ignore: unused-code, this is addressed in a TODO below.
final String errorCode;
final Map<String, List<DomainError>> domainErrors;
final Map<String, List<Path>> paths;
diff --git a/packages/devtools_app/lib/src/screens/dtd/dtd_tools_model.dart b/packages/devtools_app/lib/src/screens/dtd/dtd_tools_model.dart
index caeb175..27ddace 100644
--- a/packages/devtools_app/lib/src/screens/dtd/dtd_tools_model.dart
+++ b/packages/devtools_app/lib/src/screens/dtd/dtd_tools_model.dart
@@ -18,15 +18,10 @@
/// [service] may be null if this service method is a first party service
/// method registered by DTD or by a DTD-internal service.
class DtdServiceMethod implements Comparable<DtdServiceMethod> {
- const DtdServiceMethod({
- required this.service,
- required this.method,
- this.capabilities,
- });
+ const DtdServiceMethod({required this.service, required this.method});
final String? service;
final String method;
- final Map<String, Object?>? capabilities;
String get displayName => [service, method].nonNulls.join('.');
diff --git a/packages/devtools_app/lib/src/screens/dtd/dtd_tools_screen.dart b/packages/devtools_app/lib/src/screens/dtd/dtd_tools_screen.dart
index 774871f..46779d2 100644
--- a/packages/devtools_app/lib/src/screens/dtd/dtd_tools_screen.dart
+++ b/packages/devtools_app/lib/src/screens/dtd/dtd_tools_screen.dart
@@ -27,8 +27,6 @@
class DTDToolsScreen extends Screen {
DTDToolsScreen() : super.fromMetaData(ScreenMetaData.dtdTools);
- static final id = ScreenMetaData.dtdTools.id;
-
@override
Widget buildScreenBody(BuildContext _) => const DTDToolsScreenBody();
}
diff --git a/packages/devtools_app/lib/src/screens/dtd/services.dart b/packages/devtools_app/lib/src/screens/dtd/services.dart
index a9dc28d..8ff13fa 100644
--- a/packages/devtools_app/lib/src/screens/dtd/services.dart
+++ b/packages/devtools_app/lib/src/screens/dtd/services.dart
@@ -57,11 +57,7 @@
}),
for (final service in response.clientServices) ...[
for (final method in service.methods.values)
- DtdServiceMethod(
- service: service.name,
- method: method.name,
- capabilities: method.capabilities,
- ),
+ DtdServiceMethod(service: service.name, method: method.name),
],
];
}
diff --git a/packages/devtools_app/lib/src/screens/inspector/inspector_screen.dart b/packages/devtools_app/lib/src/screens/inspector/inspector_screen.dart
index 6b8a117..9db58fa 100644
--- a/packages/devtools_app/lib/src/screens/inspector/inspector_screen.dart
+++ b/packages/devtools_app/lib/src/screens/inspector/inspector_screen.dart
@@ -13,8 +13,6 @@
class InspectorScreen extends Screen {
InspectorScreen() : super.fromMetaData(ScreenMetaData.inspector);
- static const minScreenWidthForText = 900.0;
-
static final id = ScreenMetaData.inspector.id;
// There is not enough room to safely show the console in the embed view of
diff --git a/packages/devtools_app/lib/src/screens/inspector/inspector_screen_body.dart b/packages/devtools_app/lib/src/screens/inspector/inspector_screen_body.dart
index a112e94..f61c22f 100644
--- a/packages/devtools_app/lib/src/screens/inspector/inspector_screen_body.dart
+++ b/packages/devtools_app/lib/src/screens/inspector/inspector_screen_body.dart
@@ -53,7 +53,6 @@
SearchTargetType searchTarget = SearchTargetType.widget;
static const inspectorTreeKey = Key('Inspector Tree');
- static const minScreenWidthForText = 900.0;
@override
void initState() {
diff --git a/packages/devtools_app/lib/src/screens/inspector/layout_explorer/box/box.dart b/packages/devtools_app/lib/src/screens/inspector/layout_explorer/box/box.dart
index bfd22dd..b11a6ff 100644
--- a/packages/devtools_app/lib/src/screens/inspector/layout_explorer/box/box.dart
+++ b/packages/devtools_app/lib/src/screens/inspector/layout_explorer/box/box.dart
@@ -6,7 +6,6 @@
import '../../../../shared/diagnostics/diagnostics_node.dart';
import '../../../../shared/primitives/utils.dart';
-import '../../inspector_controller.dart';
import '../../inspector_data_models.dart';
import '../ui/free_space.dart';
import '../ui/theme.dart';
@@ -15,14 +14,12 @@
import '../ui/widgets_theme.dart';
class BoxLayoutExplorerWidget extends StatelessWidget {
- const BoxLayoutExplorerWidget(
- this.inspectorController, {
+ const BoxLayoutExplorerWidget({
super.key,
required this.layoutProperties,
required this.selectedNode,
});
- final InspectorController inspectorController;
final LayoutProperties? layoutProperties;
final RemoteDiagnosticsNode? selectedNode;
@@ -230,56 +227,6 @@
String _describeBoxName(LayoutProperties properties) =>
properties.node.description ?? '';
-/// Represents a box widget and its surrounding padding.
-class BoxChildAndPaddingVisualizer extends StatelessWidget {
- const BoxChildAndPaddingVisualizer({
- super.key,
- required this.layoutProperties,
- required this.renderProperties,
- required this.isSelected,
- });
-
- final bool isSelected;
- final LayoutProperties layoutProperties;
- final RenderProperties renderProperties;
-
- LayoutProperties? get properties => renderProperties.layoutProperties;
-
- @override
- Widget build(BuildContext context) {
- final renderSize = renderProperties.size;
- final renderOffset = renderProperties.offset;
-
- final propertiesLocal = properties!;
-
- return Positioned(
- top: renderOffset.dy,
- left: renderOffset.dx,
- child: SizedBox(
- width: safePositiveDouble(renderSize.width),
- height: safePositiveDouble(renderSize.height),
- child: WidgetVisualizer(
- isSelected: isSelected,
- layoutProperties: layoutProperties,
- title: _describeBoxName(propertiesLocal),
- // TODO(jacobr): consider surfacing the overflow size information
- // if we determine
- // overflowSide: properties.overflowSide,
-
- // We only show one child at a time so a large title is safe.
- largeTitle: true,
- child: VisualizeWidthAndHeightWithConstraints(
- arrowHeadSize: arrowHeadSize,
- properties: propertiesLocal,
- warnIfUnconstrained: false,
- child: const SizedBox.shrink(),
- ),
- ),
- ),
- );
- }
-}
-
/// Widget that represents and visualize a direct child of Flex widget.
class BoxChildVisualizer extends StatelessWidget {
const BoxChildVisualizer({
diff --git a/packages/devtools_app/lib/src/screens/inspector/layout_explorer/ui/theme.dart b/packages/devtools_app/lib/src/screens/inspector/layout_explorer/ui/theme.dart
index 666a6d9..4a1b947 100644
--- a/packages/devtools_app/lib/src/screens/inspector/layout_explorer/ui/theme.dart
+++ b/packages/devtools_app/lib/src/screens/inspector/layout_explorer/ui/theme.dart
@@ -68,11 +68,6 @@
const overflowTextColorDark = Color(0xfff5846b);
const overflowTextColorLight = Color(0xffdea089);
-const backgroundColorSelectedDark = Color(
- 0x4d474747,
-); // TODO(jacobr): we would like Color(0x4dedeeef) but that makes the background show through.
-const backgroundColorSelectedLight = Color(0x4dedeeef);
-
extension LayoutExplorerColorScheme on ColorScheme {
Color get mainAxisColor => isLight ? mainAxisLightColor : mainAxisDarkColor;
@@ -93,16 +88,10 @@
Color get overflowTextColor =>
isLight ? overflowTextColorLight : overflowTextColorDark;
- Color get backgroundColorSelected =>
- isLight ? backgroundColorSelectedLight : backgroundColorSelectedDark;
-
Color get unconstrainedColor =>
isLight ? unconstrainedLightColor : unconstrainedDarkColor;
}
-const backgroundColorDark = Color(0xff30302f);
-const backgroundColorLight = Color(0xffffffff);
-
const unconstrainedDarkColor = Color(0xffdea089);
const unconstrainedLightColor = Color(0xfff5846b);
diff --git a/packages/devtools_app/lib/src/screens/inspector/layout_explorer/ui/widgets_theme.dart b/packages/devtools_app/lib/src/screens/inspector/layout_explorer/ui/widgets_theme.dart
index a492a1c..c0a7688 100644
--- a/packages/devtools_app/lib/src/screens/inspector/layout_explorer/ui/widgets_theme.dart
+++ b/packages/devtools_app/lib/src/screens/inspector/layout_explorer/ui/widgets_theme.dart
@@ -198,7 +198,6 @@
class WidgetIcons {
static const root = 'icons/inspector/widget_icons/root.png';
static const text = 'icons/inspector/widget_icons/text.png';
- static const icon = 'icons/inspector/widget_icons/icon.png';
static const image = 'icons/inspector/widget_icons/image.png';
static const floatingActionButton =
'icons/inspector/widget_icons/floatingab.png';
diff --git a/packages/devtools_app/lib/src/screens/inspector/widget_details.dart b/packages/devtools_app/lib/src/screens/inspector/widget_details.dart
index 7f12ed5..369c657 100644
--- a/packages/devtools_app/lib/src/screens/inspector/widget_details.dart
+++ b/packages/devtools_app/lib/src/screens/inspector/widget_details.dart
@@ -50,7 +50,7 @@
);
}
- return DetailsTable(controller: controller, node: node);
+ return DetailsTable(controller: controller);
},
);
}
diff --git a/packages/devtools_app/lib/src/screens/inspector/widget_properties/properties_view.dart b/packages/devtools_app/lib/src/screens/inspector/widget_properties/properties_view.dart
index 1822d71..34ec1ac 100644
--- a/packages/devtools_app/lib/src/screens/inspector/widget_properties/properties_view.dart
+++ b/packages/devtools_app/lib/src/screens/inspector/widget_properties/properties_view.dart
@@ -20,18 +20,11 @@
/// Table for the widget's properties, along with its render object and a
/// flex layout explorer if the widget is part of a flex layout.
class DetailsTable extends StatefulWidget {
- const DetailsTable({
- super.key,
- required this.controller,
- required this.node,
- this.extraTabs,
- });
+ const DetailsTable({super.key, required this.controller});
static const gaPrefix = 'inspectorDetailsTable';
final InspectorController controller;
- final RemoteDiagnosticsNode node;
- final List<TabAndView>? extraTabs;
@override
State<DetailsTable> createState() => _DetailsTableState();
@@ -44,9 +37,6 @@
RemoteDiagnosticsNode? get selectedNode =>
widget.controller.selectedDiagnostic;
- LayoutProperties? get layoutProperties =>
- widget.controller.selectedNodeProperties.value.layoutProperties;
-
final _widgetPropertiesTab = DevToolsTab.create(
tabName: 'Widget properties',
gaPrefix: DetailsTable.gaPrefix,
@@ -269,7 +259,6 @@
height: PropertiesView.layoutExplorerHeight,
width: PropertiesView.layoutExplorerWidth,
child: BoxLayoutExplorerWidget(
- widget.controller,
selectedNode: selectedNode,
layoutProperties: widget.layoutProperties,
),
diff --git a/packages/devtools_app/lib/src/screens/logging/_logs_table.dart b/packages/devtools_app/lib/src/screens/logging/_logs_table.dart
index c406a42..2643f2f 100644
--- a/packages/devtools_app/lib/src/screens/logging/_logs_table.dart
+++ b/packages/devtools_app/lib/src/screens/logging/_logs_table.dart
@@ -2,7 +2,6 @@
// 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.
-import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import '../../shared/primitives/utils.dart';
@@ -17,8 +16,6 @@
required this.controller,
required this.data,
required this.selectionNotifier,
- required this.searchMatchesNotifier,
- required this.activeSearchMatchNotifier,
});
static const _logRowHeight = 45.0;
@@ -26,8 +23,6 @@
final LoggingController controller;
final List<LogData> data;
final ValueNotifier<LogData?> selectionNotifier;
- final ValueListenable<List<LogData>> searchMatchesNotifier;
- final ValueListenable<LogData?> activeSearchMatchNotifier;
static const whenColumn = WhenColumn();
static const messageColumn = MessageColumn();
diff --git a/packages/devtools_app/lib/src/screens/logging/logging_controller.dart b/packages/devtools_app/lib/src/screens/logging/logging_controller.dart
index b9b1c16..e92a382 100644
--- a/packages/devtools_app/lib/src/screens/logging/logging_controller.dart
+++ b/packages/devtools_app/lib/src/screens/logging/logging_controller.dart
@@ -27,7 +27,6 @@
import '../../shared/primitives/utils.dart';
import '../../shared/ui/filter.dart';
import '../../shared/ui/search.dart';
-import '../inspector/inspector_tree_controller.dart';
import 'log_details_controller.dart';
import 'logging_screen.dart';
import 'metadata.dart';
@@ -40,12 +39,6 @@
bool _verboseDebugging = false;
-typedef OnShowDetails =
- void Function({String? text, InspectorTreeController? tree});
-
-typedef CreateLoggingTree =
- InspectorTreeController Function({VoidCallback? onSelectionChange});
-
typedef ZoneDescription = ({String? name, int? identityHashCode});
Future<String> _retrieveFullStringValue(
@@ -841,8 +834,6 @@
}
extension type _LogRecord(Map<String, dynamic> json) {
- int? get sequenceNumber => json['sequenceNumber'];
-
int? get level => json['level'];
Map<String, Object?> get loggerName => json['loggerName'];
@@ -955,12 +946,6 @@
}
});
}
-
- @visibleForTesting
- LogData? get buffer => _buffer;
-
- @visibleForTesting
- Timer? get timer => _timer;
}
bool _isNotNull(InstanceRef? serviceRef) {
@@ -998,7 +983,6 @@
int? level,
this.isError = false,
this.detailsComputer,
- this.node,
this.isolateRef,
this.zone,
}) : level = level ?? (isError ? Level.SEVERE.value : Level.INFO.value) {
@@ -1029,7 +1013,6 @@
_levelName ??= LogLevelMetadataChip.generateLogLevel(level).name;
String? _levelName;
- final RemoteDiagnosticsNode? node;
String? _details;
Future<String> Function()? detailsComputer;
diff --git a/packages/devtools_app/lib/src/screens/logging/logging_screen.dart b/packages/devtools_app/lib/src/screens/logging/logging_screen.dart
index 79d2c7c..87adeca 100644
--- a/packages/devtools_app/lib/src/screens/logging/logging_screen.dart
+++ b/packages/devtools_app/lib/src/screens/logging/logging_screen.dart
@@ -80,8 +80,6 @@
controller: controller,
data: controller.filteredData.value,
selectionNotifier: controller.selectedLog,
- searchMatchesNotifier: controller.searchMatches,
- activeSearchMatchNotifier: controller.activeSearchMatch,
),
),
ValueListenableBuilder<LogData?>(
diff --git a/packages/devtools_app/lib/src/screens/memory/panes/chart/data/charts.dart b/packages/devtools_app/lib/src/screens/memory/panes/chart/data/charts.dart
index 35d7471..08273b6 100644
--- a/packages/devtools_app/lib/src/screens/memory/panes/chart/data/charts.dart
+++ b/packages/devtools_app/lib/src/screens/memory/panes/chart/data/charts.dart
@@ -9,7 +9,6 @@
import '../../../../../shared/charts/chart_trace.dart';
import '../../../../../shared/primitives/byte_utils.dart';
-import '../../../../../shared/primitives/utils.dart';
import '../../../shared/primitives/memory_timeline.dart';
/// Name of each trace being charted, index order is the trace index
@@ -48,13 +47,6 @@
const customEventName = 'name';
const customEventData = 'data';
-const indexPayloadJson = 'index';
-const timestampPayloadJson = 'timestamp';
-const prettyTimestampPayloadJson = 'prettyTimestamp';
-const eventPayloadJson = 'event';
-const vmPayloadJson = 'vm';
-const androidPayloadJson = 'android';
-
/// VM Data
const rssJsonName = 'rss';
const capacityJsonName = 'capacity';
@@ -156,17 +148,6 @@
final _android = <String, Object>{};
- Map<String, Object?> toJson() {
- return {
- indexPayloadJson: index,
- timestampPayloadJson: timestamp,
- prettyTimestampPayloadJson: prettyTimestamp(timestamp),
- eventPayloadJson: _event,
- vmPayloadJson: _vm,
- androidPayloadJson: _android,
- };
- }
-
int get eventCount =>
_event.entries.length -
(extensionEventsLength > 0 ? 1 : 0) +
diff --git a/packages/devtools_app/lib/src/screens/memory/panes/diff/widgets/instances.dart b/packages/devtools_app/lib/src/screens/memory/panes/diff/widgets/instances.dart
index 38a1af7..eb2b1b6 100644
--- a/packages/devtools_app/lib/src/screens/memory/panes/diff/widgets/instances.dart
+++ b/packages/devtools_app/lib/src/screens/memory/panes/diff/widgets/instances.dart
@@ -66,8 +66,7 @@
final SnapshotClassSampler sampler;
- // TODO(https://github.com/flutter/devtools/issues/7905): this is a bug that
- // this is unused.
+ // ignore: unused-code, TODO(https://github.com/flutter/devtools/issues/7905) this is a bug that this is unused.
final bool liveItemsEnabled;
@override
diff --git a/packages/devtools_app/lib/src/screens/memory/panes/profile/instances.dart b/packages/devtools_app/lib/src/screens/memory/panes/profile/instances.dart
index 4c11d85..9aa1894 100644
--- a/packages/devtools_app/lib/src/screens/memory/panes/profile/instances.dart
+++ b/packages/devtools_app/lib/src/screens/memory/panes/profile/instances.dart
@@ -25,8 +25,7 @@
required this.count,
}) : _shouldShowMenu = isSelected && count > 0;
- // TODO(https://github.com/flutter/devtools/issues/7905): this is a bug that
- // this is unused.
+ // ignore: unused-code, TODO(https://github.com/flutter/devtools/issues/7905): this is a bug that this is unused.
final MemoryAreas gaContext;
final int count;
final bool _shouldShowMenu;
diff --git a/packages/devtools_app/lib/src/screens/memory/panes/tracing/tracing_pane_controller.dart b/packages/devtools_app/lib/src/screens/memory/panes/tracing/tracing_pane_controller.dart
index 675da92..93f3fa3 100644
--- a/packages/devtools_app/lib/src/screens/memory/panes/tracing/tracing_pane_controller.dart
+++ b/packages/devtools_app/lib/src/screens/memory/panes/tracing/tracing_pane_controller.dart
@@ -68,6 +68,7 @@
);
/// A Future tracking whether the controller has been initialized.
+ @visibleForTesting
Future<void> get initialized => _initialized.future;
final _initialized = Completer<void>();
diff --git a/packages/devtools_app/lib/src/screens/memory/shared/primitives/memory_timeline.dart b/packages/devtools_app/lib/src/screens/memory/shared/primitives/memory_timeline.dart
index 8300073..45925c1 100644
--- a/packages/devtools_app/lib/src/screens/memory/shared/primitives/memory_timeline.dart
+++ b/packages/devtools_app/lib/src/screens/memory/shared/primitives/memory_timeline.dart
@@ -30,8 +30,6 @@
static const _jsonData = 'data';
- int get endingIndex => data.isNotEmpty ? data.length - 1 : -1;
-
/// Raw Heap sampling data from the VM.
late final List<HeapSample> data;
diff --git a/packages/devtools_app/lib/src/screens/network/constants.dart b/packages/devtools_app/lib/src/screens/network/constants.dart
index e8fa703..be66652 100644
--- a/packages/devtools_app/lib/src/screens/network/constants.dart
+++ b/packages/devtools_app/lib/src/screens/network/constants.dart
@@ -7,15 +7,8 @@
version,
creator,
name,
- pages,
startedDateTime,
- id,
- title,
- pageTimings,
- onContentLoad,
- onLoad,
entries,
- pageref,
time,
request,
method,
@@ -44,7 +37,6 @@
wait,
receive,
ssl,
- serverIPAddress,
connection,
comment,
value,
@@ -62,8 +54,6 @@
class NetworkEventDefaults {
static const logVersion = '1.2';
static const creatorName = 'devtools';
- static const onContentLoad = -1;
- static const onLoad = -1;
static const httpVersion = 'HTTP/1.1';
static const responseHttpVersion = 'http/2.0';
static const blocked = -1;
diff --git a/packages/devtools_app/lib/src/screens/network/har_network_data.dart b/packages/devtools_app/lib/src/screens/network/har_network_data.dart
index 7895e00..f8519bc 100644
--- a/packages/devtools_app/lib/src/screens/network/har_network_data.dart
+++ b/packages/devtools_app/lib/src/screens/network/har_network_data.dart
@@ -3,6 +3,7 @@
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
import 'package:devtools_shared/devtools_shared.dart';
+import 'package:meta/meta.dart';
import '../../shared/http/http_request_data.dart';
import 'constants.dart';
import 'har_builder.dart';
@@ -28,6 +29,7 @@
/// ```dart
/// final harData = HarNetworkData.fromJson(json);
/// ```
+ @visibleForTesting
factory HarNetworkData.fromJson(Map<String, Object?> json) {
final entries =
((json[NetworkEventKeys.log.name]
diff --git a/packages/devtools_app/lib/src/screens/network/network_model.dart b/packages/devtools_app/lib/src/screens/network/network_model.dart
index 9ccc3c5..3d7fa03 100644
--- a/packages/devtools_app/lib/src/screens/network/network_model.dart
+++ b/packages/devtools_app/lib/src/screens/network/network_model.dart
@@ -192,8 +192,6 @@
@override
int get hashCode => id.hashCode;
- SocketStatistic get socketData => _socket;
-
@override
Map<String, Object?> toJson() {
return {
diff --git a/packages/devtools_app/lib/src/screens/network/network_screen.dart b/packages/devtools_app/lib/src/screens/network/network_screen.dart
index 81202fb..5006eee 100644
--- a/packages/devtools_app/lib/src/screens/network/network_screen.dart
+++ b/packages/devtools_app/lib/src/screens/network/network_screen.dart
@@ -6,7 +6,6 @@
import 'package:devtools_app_shared/ui.dart';
import 'package:devtools_app_shared/utils.dart';
-import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@@ -320,11 +319,7 @@
ValueListenableBuilder<List<NetworkRequest>>(
valueListenable: controller.filteredData,
builder: (context, filteredRequests, _) {
- return NetworkRequestsTable(
- requests: filteredRequests,
- searchMatchesNotifier: controller.searchMatches,
- activeSearchMatchNotifier: controller.activeSearchMatch,
- );
+ return NetworkRequestsTable(requests: filteredRequests);
},
),
const NetworkRequestInspector(),
@@ -334,12 +329,7 @@
}
class NetworkRequestsTable extends StatelessWidget {
- const NetworkRequestsTable({
- super.key,
- required this.requests,
- required this.searchMatchesNotifier,
- required this.activeSearchMatchNotifier,
- });
+ const NetworkRequestsTable({super.key, required this.requests});
static const methodColumn = MethodColumn();
static final addressColumn = AddressColumn();
@@ -361,8 +351,6 @@
];
final List<NetworkRequest> requests;
- final ValueListenable<List<NetworkRequest>> searchMatchesNotifier;
- final ValueListenable<NetworkRequest?> activeSearchMatchNotifier;
@override
Widget build(BuildContext context) {
diff --git a/packages/devtools_app/lib/src/screens/network/offline_network_data.dart b/packages/devtools_app/lib/src/screens/network/offline_network_data.dart
index ce6855a..2a7cc91 100644
--- a/packages/devtools_app/lib/src/screens/network/offline_network_data.dart
+++ b/packages/devtools_app/lib/src/screens/network/offline_network_data.dart
@@ -3,6 +3,7 @@
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
import 'package:devtools_shared/devtools_shared.dart';
+import 'package:meta/meta.dart';
import '../../shared/http/http_request_data.dart';
import '../network/network_controller.dart';
@@ -65,6 +66,7 @@
);
}
+ @visibleForTesting
bool get isEmpty => httpRequestData.isEmpty && socketData.isEmpty;
/// List of current [DartIOHttpRequestData] network requests.
diff --git a/packages/devtools_app/lib/src/screens/performance/panes/flutter_frames/flutter_frame_model.dart b/packages/devtools_app/lib/src/screens/performance/panes/flutter_frames/flutter_frame_model.dart
index 9b199db..04b4cf7 100644
--- a/packages/devtools_app/lib/src/screens/performance/panes/flutter_frames/flutter_frame_model.dart
+++ b/packages/devtools_app/lib/src/screens/performance/panes/flutter_frames/flutter_frame_model.dart
@@ -165,10 +165,6 @@
timelineEventData.rasterEvent?.writeTrackEventsToBuffer(buf);
return buf.toString();
}
-
- FlutterFrame shallowCopy() {
- return FlutterFrame.fromJson(json);
- }
}
class FrameTimelineEventData {
diff --git a/packages/devtools_app/lib/src/screens/performance/panes/flutter_frames/flutter_frames_controller.dart b/packages/devtools_app/lib/src/screens/performance/panes/flutter_frames/flutter_frames_controller.dart
index ff97028..309b5c7 100644
--- a/packages/devtools_app/lib/src/screens/performance/panes/flutter_frames/flutter_frames_controller.dart
+++ b/packages/devtools_app/lib/src/screens/performance/panes/flutter_frames/flutter_frames_controller.dart
@@ -61,11 +61,6 @@
/// frame id in the corresponding [FlutterTimelineEvent]s.
final _unassignedFlutterFrames = <int, FlutterFrame>{};
- /// Tracks the current frame undergoing selection so that we can equality
- /// check after async operations and bail out early if another frame has been
- /// selected during awaits.
- FlutterFrame? currentFrameBeingSelected;
-
@override
Future<void> init() async {
if (!offlineDataController.showingOfflineData.value) {
@@ -184,8 +179,6 @@
@override
void handleSelectedFrame(FlutterFrame frame) {
- currentFrameBeingSelected = frame;
-
// Unselect [frame] if is already selected.
if (_selectedFrameNotifier.value == frame) {
_selectedFrameNotifier.value = null;
diff --git a/packages/devtools_app/lib/src/screens/performance/panes/frame_analysis/frame_analysis_model.dart b/packages/devtools_app/lib/src/screens/performance/panes/frame_analysis/frame_analysis_model.dart
index 0e82e25..b2495ef 100644
--- a/packages/devtools_app/lib/src/screens/performance/panes/frame_analysis/frame_analysis_model.dart
+++ b/packages/devtools_app/lib/src/screens/performance/panes/frame_analysis/frame_analysis_model.dart
@@ -2,6 +2,8 @@
// 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.
+import 'package:meta/meta.dart';
+
import '../../../../shared/primitives/trees.dart';
import '../../../../shared/primitives/utils.dart';
import '../../performance_model.dart';
@@ -128,6 +130,7 @@
return longest;
}
+ @visibleForTesting
bool get hasExpensiveOperations =>
saveLayerCount + intrinsicOperationsCount > 0;
diff --git a/packages/devtools_app/lib/src/screens/performance/panes/rebuild_stats/rebuild_stats_model.dart b/packages/devtools_app/lib/src/screens/performance/panes/rebuild_stats/rebuild_stats_model.dart
index 153778f..91c1d0a 100644
--- a/packages/devtools_app/lib/src/screens/performance/panes/rebuild_stats/rebuild_stats_model.dart
+++ b/packages/devtools_app/lib/src/screens/performance/panes/rebuild_stats/rebuild_stats_model.dart
@@ -211,8 +211,6 @@
return _rebuildsForFrame[frameNumber];
}
- bool get isNotEmpty => _rebuildsForFrame.isNotEmpty;
-
Map<String, Object?>? toJson() {
if (_rebuildsForFrame.isEmpty) {
// No need to encode data unless there were actually rebuilds reported.
diff --git a/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/perfetto/_perfetto_controller_web.dart b/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/perfetto/_perfetto_controller_web.dart
index c032ba1..e284d9d 100644
--- a/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/perfetto/_perfetto_controller_web.dart
+++ b/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/perfetto/_perfetto_controller_web.dart
@@ -159,6 +159,7 @@
final perfettoPostEventStream = StreamController<String>.broadcast();
+ // ignore: unused-code, TODO(https://github.com/flutter/devtools/issues/9907) false positive.
bool _initialized = false;
@override
diff --git a/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/perfetto/_perfetto_desktop.dart b/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/perfetto/_perfetto_desktop.dart
index 1315d95..7f0881a 100644
--- a/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/perfetto/_perfetto_desktop.dart
+++ b/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/perfetto/_perfetto_desktop.dart
@@ -7,9 +7,7 @@
import 'perfetto_controller.dart';
class Perfetto extends StatelessWidget {
- const Perfetto({super.key, required this.perfettoController});
-
- final PerfettoController perfettoController;
+ const Perfetto({super.key, required PerfettoController perfettoController});
@override
Widget build(BuildContext context) {
diff --git a/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/perfetto/tracing/model.dart b/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/perfetto/tracing/model.dart
index c2ec2f4..e3ddac1 100644
--- a/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/perfetto/tracing/model.dart
+++ b/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/perfetto/tracing/model.dart
@@ -101,6 +101,7 @@
].nonNulls,
);
+ @visibleForTesting
List<String> get categories => event.categories;
/// The id of the Perfetto track that this event is included in.
diff --git a/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/timeline_events_controller.dart b/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/timeline_events_controller.dart
index 5383078..c372911 100644
--- a/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/timeline_events_controller.dart
+++ b/packages/devtools_app/lib/src/screens/performance/panes/timeline_events/timeline_events_controller.dart
@@ -49,7 +49,6 @@
static const uiThreadSuffix = '.ui';
static const rasterThreadSuffix = '.raster';
- static const gpuThreadSuffix = '.gpu';
static const platformThreadSuffix = '.platform';
static const flutterTestThreadSuffix = '.flutter.test..ui';
static final _refreshWorkTrackerDelay = const Duration(
diff --git a/packages/devtools_app/lib/src/screens/performance/performance_model.dart b/packages/devtools_app/lib/src/screens/performance/performance_model.dart
index a965879..89c3107 100644
--- a/packages/devtools_app/lib/src/screens/performance/performance_model.dart
+++ b/packages/devtools_app/lib/src/screens/performance/performance_model.dart
@@ -163,16 +163,6 @@
timeBuilder: _timeBuilder.copy(),
);
- @visibleForTesting
- FlutterTimelineEvent deepCopy() {
- final copy = shallowCopy();
- copy.parent = parent;
- for (final child in children) {
- copy.addChild(child.deepCopy());
- }
- return copy;
- }
-
@override
String toString() {
final buf = StringBuffer();
diff --git a/packages/devtools_app/lib/src/screens/profiler/cpu_profile_model.dart b/packages/devtools_app/lib/src/screens/profiler/cpu_profile_model.dart
index f1eb442..82b0f1f 100644
--- a/packages/devtools_app/lib/src/screens/profiler/cpu_profile_model.dart
+++ b/packages/devtools_app/lib/src/screens/profiler/cpu_profile_model.dart
@@ -577,7 +577,6 @@
final stackFrames =
await _CpuStackFrameGenerator(
isolateId: isolateId,
- cpuSamples: cpuSamples,
profileMetaData: profileMetaData,
).generate(
treeRoot: _CpuProfileTimelineTree.fromCpuSamples(
@@ -1175,11 +1174,6 @@
_profilesByTime.clear();
_profilesByLabel.clear();
}
-
- void debugPrintKeys() {
- _log.info('_profilesByLabel: ${_profilesByLabel.keys}');
- _log.info('_profilesByTime: ${_profilesByTime.keys}');
- }
}
class _CpuProfileTimelineTree {
@@ -1329,7 +1323,7 @@
}
/// A generator class for creating a set of [CpuStackFrame]s from a
-/// [vm_service.CpuSamples] object.
+/// [_CpuProfileTimelineTree] object.
///
/// This class is responsible for traversing the call stacks of a CPU profile,
/// creating a [CpuStackFrame] for each unique frame, and assigning a unique
@@ -1339,12 +1333,10 @@
class _CpuStackFrameGenerator {
_CpuStackFrameGenerator({
required this.isolateId,
- required this.cpuSamples,
required this.profileMetaData,
});
final String isolateId;
- final vm_service.CpuSamples cpuSamples;
final CpuProfileMetaData profileMetaData;
final _stackFrames = <String, CpuStackFrame>{};
diff --git a/packages/devtools_app/lib/src/screens/profiler/cpu_profiler_controller.dart b/packages/devtools_app/lib/src/screens/profiler/cpu_profiler_controller.dart
index 4caea9b..4274eb2 100644
--- a/packages/devtools_app/lib/src/screens/profiler/cpu_profiler_controller.dart
+++ b/packages/devtools_app/lib/src/screens/profiler/cpu_profiler_controller.dart
@@ -411,6 +411,7 @@
return '$label${filterTag.isNotEmpty ? '-$filterTag' : ''}';
}
+ // ignore: unused-code, TODO(https://github.com/flutter/devtools/issues/9910) seems like a bug.
Future<void> loadAppStartUpProfile() async {
Future<void> loadAppStartUpProfileHelper() async {
// Look up the stored app start up profiles before calling [reset]. This
diff --git a/packages/devtools_app/lib/src/screens/profiler/panes/controls/profiler_screen_controls.dart b/packages/devtools_app/lib/src/screens/profiler/panes/controls/profiler_screen_controls.dart
index fbc7cb0..c1c5b24 100644
--- a/packages/devtools_app/lib/src/screens/profiler/panes/controls/profiler_screen_controls.dart
+++ b/packages/devtools_app/lib/src/screens/profiler/panes/controls/profiler_screen_controls.dart
@@ -18,7 +18,6 @@
required this.controller,
required this.recording,
required this.processing,
- required this.offline,
});
final ProfilerScreenController controller;
@@ -27,8 +26,6 @@
final bool processing;
- final bool offline;
-
@override
Widget build(BuildContext context) {
return OfflineAwareControls(
diff --git a/packages/devtools_app/lib/src/screens/profiler/panes/method_table/method_table_model.dart b/packages/devtools_app/lib/src/screens/profiler/panes/method_table/method_table_model.dart
index d7e78be..93b7cc9 100644
--- a/packages/devtools_app/lib/src/screens/profiler/panes/method_table/method_table_model.dart
+++ b/packages/devtools_app/lib/src/screens/profiler/panes/method_table/method_table_model.dart
@@ -3,6 +3,7 @@
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
import 'package:collection/collection.dart';
+import 'package:meta/meta.dart';
import '../../../../shared/primitives/graph.dart';
import '../../../../shared/primitives/utils.dart';
@@ -136,6 +137,7 @@
''';
}
+ @visibleForTesting
MethodTableGraphNode copy() {
return MethodTableGraphNode(
name: name,
diff --git a/packages/devtools_app/lib/src/screens/profiler/profiler_screen.dart b/packages/devtools_app/lib/src/screens/profiler/profiler_screen.dart
index cf473f5..ae60c9a 100644
--- a/packages/devtools_app/lib/src/screens/profiler/profiler_screen.dart
+++ b/packages/devtools_app/lib/src/screens/profiler/profiler_screen.dart
@@ -142,7 +142,6 @@
controller: controller,
recording: recording,
processing: profilerBusy,
- offline: offlineDataController.showingOfflineData.value,
),
const SizedBox(height: intermediateSpacing),
Expanded(
diff --git a/packages/devtools_app/lib/src/screens/provider/provider_screen.dart b/packages/devtools_app/lib/src/screens/provider/provider_screen.dart
index e4f077a..027ee4e 100644
--- a/packages/devtools_app/lib/src/screens/provider/provider_screen.dart
+++ b/packages/devtools_app/lib/src/screens/provider/provider_screen.dart
@@ -11,8 +11,6 @@
class ProviderScreen extends Screen {
ProviderScreen() : super.fromMetaData(ScreenMetaData.provider);
- static final id = ScreenMetaData.provider.id;
-
@override
Widget buildScreenBody(BuildContext context) {
return CenteredMessage(
diff --git a/packages/devtools_app/lib/src/screens/vm_developer/object_inspector/inbound_references_tree.dart b/packages/devtools_app/lib/src/screens/vm_developer/object_inspector/inbound_references_tree.dart
index c48c3c3..56d3124 100644
--- a/packages/devtools_app/lib/src/screens/vm_developer/object_inspector/inbound_references_tree.dart
+++ b/packages/devtools_app/lib/src/screens/vm_developer/object_inspector/inbound_references_tree.dart
@@ -26,6 +26,7 @@
@override
bool get isExpandable => ref.source != null;
+ // ignore: unused-code, TODO(https://github.com/flutter/devtools/issues/9910) this seems like a bug.
late final description = _inboundRefDescription(ref, null);
/// Wrapper to get the name of an [ObjRef] depending on its type.
diff --git a/packages/devtools_app/lib/src/screens/vm_developer/vm_developer_tools_screen.dart b/packages/devtools_app/lib/src/screens/vm_developer/vm_developer_tools_screen.dart
index e30f8cd..e544efd 100644
--- a/packages/devtools_app/lib/src/screens/vm_developer/vm_developer_tools_screen.dart
+++ b/packages/devtools_app/lib/src/screens/vm_developer/vm_developer_tools_screen.dart
@@ -37,8 +37,6 @@
class VMDeveloperToolsScreen extends Screen {
VMDeveloperToolsScreen() : super.fromMetaData(ScreenMetaData.vmTools);
- static final id = ScreenMetaData.vmTools.id;
-
@override
ValueListenable<bool> get showIsolateSelector =>
VMDeveloperToolsController.showIsolateSelector;
diff --git a/packages/devtools_app/lib/src/screens/vm_developer/vm_service_private_extensions.dart b/packages/devtools_app/lib/src/screens/vm_developer/vm_service_private_extensions.dart
index 7b8c3c4..7912238 100644
--- a/packages/devtools_app/lib/src/screens/vm_developer/vm_service_private_extensions.dart
+++ b/packages/devtools_app/lib/src/screens/vm_developer/vm_service_private_extensions.dart
@@ -55,33 +55,7 @@
(json!['_heaps'] as Map).cast<String, Object?>();
}
-/// An extension on [Class] which allows for access to VM internal fields.
-extension ClassPrivateViewExtension on Class {
- /// The internal name of the [Class].
- String get vmName => json![_vmNameKey];
-}
-
-/// An extension on [InboundReferences] which allows for access to
-/// VM internal fields.
-extension InboundReferenceExtension on InboundReferences {
- static const _referencesKey = 'references';
- static const _parentWordOffsetKey = '_parentWordOffset';
-
- int? parentWordOffset(int inboundReferenceIndex) {
- final references = (json![_referencesKey] as List?)?.cast<Object?>();
- final inboundReference = (references?[inboundReferenceIndex] as Map?)
- ?.cast<String, Object?>();
- return inboundReference?[_parentWordOffsetKey] as int?;
- }
-}
-
class HeapStats {
- const HeapStats({
- required this.count,
- required this.size,
- required this.externalSize,
- });
-
const HeapStats.empty() : count = 0, size = 0, externalSize = 0;
HeapStats.parse(List<int> stats)
@@ -172,10 +146,6 @@
/// `true` if this object is an instance of [SubtypeTestCacheRef].
bool get isSubtypeTestCache => vmType == _subtypeTestCache;
- /// Casts the current [ObjRef] into an instance of [SubtypeTestCacheRef].
- SubtypeTestCacheRef get asSubtypeTestCache =>
- SubtypeTestCacheRef.fromJson(json!);
-
/// `true` if this object is an instance of [WeakArrayRef].
bool get isWeakArray => vmType == _weakArrayType;
@@ -273,9 +243,6 @@
class SubtypeTestCacheRef implements ObjRef {
SubtypeTestCacheRef({required this.id, required this.json});
- factory SubtypeTestCacheRef.fromJson(Map<String, dynamic> json) =>
- SubtypeTestCacheRef(id: json['id'], json: json);
-
@override
bool? fixedId;
@@ -540,22 +507,15 @@
/// An extension on [Code] which allows for access to VM internal fields.
extension CodePrivateViewExtension on Code {
static const _disassemblyKey = '_disassembly';
- static const _kindKey = 'kind';
static const _objectPoolKey = '_objectPool';
/// Returns the disassembly of the [Code], which is the generated assembly
/// instructions for the code's function.
Disassembly get disassembly => Disassembly.parse(json![_disassemblyKey]);
+ @visibleForTesting
set disassembly(Disassembly disassembly) =>
json![_disassemblyKey] = disassembly.toJson();
- /// The kind of code object represented by this instance.
- ///
- /// Can be one of:
- /// - Dart
- /// - Stub
- String get kind => json![_kindKey];
-
ObjectPoolRef get objectPool => ObjectPoolRef.parse(json![_objectPoolKey]);
bool get hasInliningData => json!.containsKey(InliningData.kInlinedFunctions);
@@ -676,20 +636,6 @@
static const _kObject = 'Object';
static const _kImm = 'Immediate';
- static const _kNativeFunction = 'NativeFunction';
-
- static ObjectPoolEntryKind fromString(String type) {
- switch (type) {
- case _kObject:
- return object;
- case _kImm:
- return immediate;
- case _kNativeFunction:
- return nativeFunction;
- default:
- throw UnsupportedError('Unsupported ObjectPoolType: $type');
- }
- }
@override
String toString() {
@@ -705,26 +651,18 @@
}
class ObjectPoolEntry {
- const ObjectPoolEntry({
- required this.offset,
- required this.kind,
- required this.value,
- });
+ const ObjectPoolEntry({required this.offset, required this.value});
static const _offsetKey = 'offset';
- static const _kindKey = 'kind';
static const _valueKey = 'value';
static ObjectPoolEntry parse(Map<String, dynamic> json) => ObjectPoolEntry(
offset: json[_offsetKey],
- kind: ObjectPoolEntryKind.fromString(json[_kindKey]),
value: createServiceObject(json[_valueKey], [])!,
);
final int offset;
- final ObjectPoolEntryKind kind;
-
final Object value;
}
@@ -850,14 +788,6 @@
///
/// See [CpuSamples].
class ProfileCode {
- ProfileCode({
- this.kind,
- this.inclusiveTicks,
- this.exclusiveTicks,
- this.code,
- this.ticks,
- });
-
ProfileCode._fromJson(Map<String, dynamic> json) {
kind = json['kind'] ?? '';
inclusiveTicks = json['inclusiveTicks'] ?? -1;
@@ -883,6 +813,7 @@
List? ticks;
+ // ignore: unused-code, TODO(https://github.com/flutter/devtools/issues/9910) seems like a bug.
Map<String, Object?> toJson() {
final json = <String, Object?>{};
json.addAll({
@@ -915,10 +846,6 @@
static const _kCodesKey = '_codes';
- bool get hasCodes {
- return _expando[this] != null || json!.containsKey(_kCodesKey);
- }
-
List<ProfileCode> get codes {
return _expando[this] ??= (json![_kCodesKey] as List)
.cast<Map<String, dynamic>>()
@@ -936,13 +863,11 @@
class ProfileReportEntry {
const ProfileReportEntry({
required this.sampleCount,
- required this.line,
required this.inclusive,
required this.exclusive,
});
final int sampleCount;
- final int line;
final int inclusive;
final int exclusive;
@@ -970,7 +895,6 @@
final line = lines[i];
entries[line] = ProfileReportEntry(
sampleCount: json.sampleCount,
- line: line,
inclusive: inclusiveTicks[i],
exclusive: exclusiveTicks[i],
);
diff --git a/packages/devtools_app/test/screens/debugger/debugger_screen_breakpoints_test.dart b/packages/devtools_app/test/screens/debugger/debugger_screen_breakpoints_test.dart
index 7470497..90594f9 100644
--- a/packages/devtools_app/test/screens/debugger/debugger_screen_breakpoints_test.dart
+++ b/packages/devtools_app/test/screens/debugger/debugger_screen_breakpoints_test.dart
@@ -57,9 +57,6 @@
];
final codeViewController = debuggerController.codeViewController;
when(
- mockBreakpointManager.breakpoints,
- ).thenReturn(ValueNotifier(breakpoints));
- when(
mockBreakpointManager.breakpointsWithLocation,
).thenReturn(ValueNotifier(breakpointsWithLocation));
diff --git a/packages/devtools_app/test/screens/vm_developer/object_inspector/vm_object_pool_display_test.dart b/packages/devtools_app/test/screens/vm_developer/object_inspector/vm_object_pool_display_test.dart
index d0541ed..01f73ee 100644
--- a/packages/devtools_app/test/screens/vm_developer/object_inspector/vm_object_pool_display_test.dart
+++ b/packages/devtools_app/test/screens/vm_developer/object_inspector/vm_object_pool_display_test.dart
@@ -37,21 +37,15 @@
final objectPoolEntries = <ObjectPoolEntry>[
ObjectPoolEntry(
offset: 0,
- kind: ObjectPoolEntryKind.object,
value: InstanceRef(
id: 'fake-inst',
kind: InstanceKind.kList,
length: 0,
),
),
- const ObjectPoolEntry(
- offset: 10,
- kind: ObjectPoolEntryKind.immediate,
- value: 42,
- ),
+ const ObjectPoolEntry(offset: 10, value: 42),
ObjectPoolEntry(
offset: 20,
- kind: ObjectPoolEntryKind.nativeFunction,
value: FuncRef(id: 'func-id', name: 'Foo'),
),
];
diff --git a/packages/devtools_test/lib/src/helpers/utils.dart b/packages/devtools_test/lib/src/helpers/utils.dart
index a11e365..510471b 100644
--- a/packages/devtools_test/lib/src/helpers/utils.dart
+++ b/packages/devtools_test/lib/src/helpers/utils.dart
@@ -35,21 +35,6 @@
const longPumpDuration = Duration(seconds: 6);
const veryLongPumpDuration = Duration(seconds: 9);
-final screenIds = <String>[
- AppSizeScreen.id,
- DebuggerScreen.id,
- DeepLinksScreen.id,
- InspectorScreen.id,
- LoggingScreen.id,
- MemoryScreen.id,
- NetworkScreen.id,
- PerformanceScreen.id,
- ProfilerScreen.id,
- ProviderScreen.id,
- VMDeveloperToolsScreen.id,
- DTDToolsScreen.id,
-];
-
/// Scoping method which registers `listener` as a listener for `listenable`,
/// invokes `callback`, and then removes the `listener`.
///
diff --git a/packages/devtools_test/lib/src/mocks/fake_service_manager.dart b/packages/devtools_test/lib/src/mocks/fake_service_manager.dart
index 35efaa8..1b4027f 100644
--- a/packages/devtools_test/lib/src/mocks/fake_service_manager.dart
+++ b/packages/devtools_test/lib/src/mocks/fake_service_manager.dart
@@ -13,7 +13,6 @@
import 'package:mockito/mockito.dart';
import 'package:vm_service/vm_service.dart';
-import '../helpers/utils.dart';
import 'fake_isolate_manager.dart';
import 'fake_service_extension_manager.dart';
import 'fake_vm_service_wrapper.dart';
@@ -39,7 +38,8 @@
availableServices: availableServices,
rootLibrary: rootLibrary,
);
- for (final screenId in screenIds) {
+ for (final screen in ScreenMetaData.values) {
+ final screenId = screen.id;
when(errorBadgeManager.erroredItemsForPage(screenId)).thenReturn(
FixedValueListenable(LinkedHashMap<String, DevToolsError>()),
);
diff --git a/packages/devtools_test/lib/src/mocks/mocks.dart b/packages/devtools_test/lib/src/mocks/mocks.dart
index d4fd888..ca204b3 100644
--- a/packages/devtools_test/lib/src/mocks/mocks.dart
+++ b/packages/devtools_test/lib/src/mocks/mocks.dart
@@ -237,6 +237,7 @@
return Script.parse(jsonDecode(script.readAsStringSync()));
}
+// ignore: invalid_use_of_visible_for_testing_member, devtools_test is only used in tests.
final mockSyntaxHighlighter = SyntaxHighlighter.withGrammar(
grammar: mockGrammar,
source: mockScript!.source,
@@ -249,10 +250,10 @@
const executableLines = <int>{...coverageHitLines, ...coverageMissLines};
const profilerEntries = <int, ProfileReportEntry>{
- 1: ProfileReportEntry(sampleCount: 5, line: 1, inclusive: 2, exclusive: 2),
- 3: ProfileReportEntry(sampleCount: 5, line: 3, inclusive: 1, exclusive: 1),
- 4: ProfileReportEntry(sampleCount: 5, line: 4, inclusive: 1, exclusive: 1),
- 7: ProfileReportEntry(sampleCount: 5, line: 7, inclusive: 1, exclusive: 1),
+ 1: ProfileReportEntry(sampleCount: 5, inclusive: 2, exclusive: 2),
+ 3: ProfileReportEntry(sampleCount: 5, inclusive: 1, exclusive: 1),
+ 4: ProfileReportEntry(sampleCount: 5, inclusive: 1, exclusive: 1),
+ 7: ProfileReportEntry(sampleCount: 5, inclusive: 1, exclusive: 1),
};
final mockParsedScript = ParsedScript(