Skip to content

Commit 229a147

Browse files
authored
Remove unused code (#5301)
Removes unused code, detected by `check-unused-code`.
1 parent 171045e commit 229a147

File tree

71 files changed

+28
-1015
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+28
-1015
lines changed

packages/devtools_app/integration_test/test_infra/run/_test_app_driver.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ class TestFlutterApp extends _TestApp {
1515
TestFlutterApp({String appPath = 'test/test_infra/fixtures/flutter_app'})
1616
: super(appPath);
1717

18-
Directory get workingDirectory => Directory(testAppPath);
19-
2018
@override
2119
Future<void> startProcess() async {
2220
runProcess = await Process.start(

packages/devtools_app/lib/src/app.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ class DevToolsAppState extends State<DevToolsApp> with AutoDisposeMixin {
242242
providers: _providedControllers(),
243243
child: DevToolsScaffold(
244244
embed: embed,
245-
ideTheme: ideTheme,
246245
page: page,
247246
screens: screens,
248247
actions: [

packages/devtools_app/lib/src/framework/initializer.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import 'package:flutter/material.dart';
1010
import '../shared/analytics/analytics.dart' as ga;
1111
import '../shared/analytics/constants.dart' as gac;
1212
import '../shared/common_widgets.dart';
13+
import '../shared/framework_controller.dart';
1314
import '../shared/globals.dart';
1415
import '../shared/primitives/auto_dispose.dart';
1516
import '../shared/primitives/utils.dart';
@@ -104,7 +105,7 @@ class _InitializerState extends State<Initializer>
104105
/// Connects to the VM with the given URI. This request usually comes from the
105106
/// IDE via the server API to reuse the DevTools window after being disconnected
106107
/// (for example if the user stops a debug session then launches a new one).
107-
void _connectVm(event) {
108+
void _connectVm(ConnectVmEvent event) {
108109
DevToolsRouterDelegate.of(context).updateArgsIfChanged({
109110
'uri': event.serviceProtocolUri.toString(),
110111
if (event.notify) 'notify': 'true',

packages/devtools_app/lib/src/framework/scaffold.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ class DevToolsScaffold extends StatefulWidget {
4141
this.page,
4242
this.actions,
4343
this.embed = false,
44-
required this.ideTheme,
4544
}) : super(key: key);
4645

4746
DevToolsScaffold.withChild({
@@ -52,7 +51,6 @@ class DevToolsScaffold extends StatefulWidget {
5251
}) : this(
5352
key: key,
5453
screens: [SimpleScreen(child)],
55-
ideTheme: ideTheme,
5654
actions: actions,
5755
);
5856

@@ -85,9 +83,6 @@ class DevToolsScaffold extends StatefulWidget {
8583
/// Whether to render the embedded view (without the header).
8684
final bool embed;
8785

88-
/// IDE-supplied theming.
89-
final IdeTheme ideTheme;
90-
9186
/// Actions that it's possible to perform in this Scaffold.
9287
///
9388
/// These will generally be [RegisteredServiceExtensionButton]s.

packages/devtools_app/lib/src/screens/debugger/codeview.dart

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ class _CodeViewState extends State<CodeView>
282282
return Stack(
283283
children: [
284284
scriptRef == null
285-
? CodeViewEmptyState(widget: widget, context: context)
285+
? CodeViewEmptyState(widget: widget)
286286
: buildCodeArea(context),
287287
if (showFileOpener)
288288
Positioned(
@@ -544,11 +544,9 @@ class CodeViewEmptyState extends StatelessWidget {
544544
const CodeViewEmptyState({
545545
super.key,
546546
required this.widget,
547-
required this.context,
548547
});
549548

550549
final CodeView widget;
551-
final BuildContext context;
552550

553551
@override
554552
Widget build(BuildContext context) {
@@ -619,10 +617,7 @@ class ProfileInformationGutter extends StatelessWidget {
619617
if (data == null) {
620618
return const SizedBox();
621619
}
622-
return ProfileInformationGutterItem(
623-
lineNumber: lineNum,
624-
profilerData: data,
625-
);
620+
return ProfileInformationGutterItem(profilerData: data);
626621
},
627622
),
628623
),
@@ -692,12 +687,9 @@ class _ProfileInformationGutterHeader extends StatelessWidget {
692687
class ProfileInformationGutterItem extends StatelessWidget {
693688
const ProfileInformationGutterItem({
694689
Key? key,
695-
required this.lineNumber,
696690
required this.profilerData,
697691
}) : super(key: key);
698692

699-
final int lineNumber;
700-
701693
final ProfileReportEntry profilerData;
702694

703695
@override

packages/devtools_app/lib/src/screens/debugger/debugger_model.dart

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -253,15 +253,6 @@ class FileNode extends TreeNode<FileNode> {
253253
/// This exists to allow for O(1) lookup of children when building the tree.
254254
final Map<String, FileNode> _childrenAsMap = {};
255255

256-
bool get hasScript => scriptRef != null;
257-
258-
String _fileName = '';
259-
260-
/// Returns the name of the file.
261-
///
262-
/// May be empty.
263-
String get fileName => _fileName;
264-
265256
/// Given a flat list of service protocol scripts, return a tree of scripts
266257
/// representing the best hierarchical grouping.
267258
static List<FileNode> createRootsFrom(List<ScriptRef> scripts) {
@@ -278,7 +269,6 @@ class FileNode extends TreeNode<FileNode> {
278269
}
279270

280271
node.scriptRef = script;
281-
node._fileName = ScriptRefUtils.fileName(script);
282272
}
283273

284274
// Clear out the _childrenAsMap map.

packages/devtools_app/lib/src/screens/debugger/program_explorer.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import 'program_explorer_model.dart';
2121

2222
const containerIcon = Icons.folder;
2323
const libraryIcon = Icons.insert_drive_file;
24-
const listItemHeight = 40.0;
2524

2625
double get _programExplorerRowHeight => scaleByFontFactor(22.0);
2726
double get _selectedNodeTopSpacing => _programExplorerRowHeight * 3;
@@ -428,14 +427,12 @@ class ProgramExplorer extends StatelessWidget {
428427
required this.controller,
429428
this.title = 'File Explorer',
430429
this.onNodeSelected,
431-
this.displayCodeNodes = false,
432430
this.displayHeader = true,
433431
});
434432

435433
final ProgramExplorerController controller;
436434
final String title;
437435
final void Function(VMServiceObjectNode)? onNodeSelected;
438-
final bool displayCodeNodes;
439436
final bool displayHeader;
440437

441438
@override

packages/devtools_app/lib/src/screens/inspector/inspector_data_models.dart

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -128,23 +128,6 @@ class LayoutProperties {
128128
}
129129
}
130130

131-
factory LayoutProperties.lerp(
132-
LayoutProperties begin,
133-
LayoutProperties end,
134-
double t,
135-
) {
136-
return LayoutProperties.values(
137-
node: end.node,
138-
children: end.children,
139-
constraints: BoxConstraints.lerp(begin.constraints, end.constraints, t),
140-
description: end.description,
141-
flexFactor: begin.flexFactor! * (t + 1) - end.flexFactor! * t,
142-
isFlex: begin.isFlex && end.isFlex,
143-
size: Size.lerp(begin.size, end.size, t)!,
144-
flexFit: end.flexFit,
145-
);
146-
}
147-
148131
LayoutProperties? parent;
149132
final RemoteDiagnosticsNode node;
150133
final List<LayoutProperties> children;

packages/devtools_app/lib/src/screens/inspector/layout_explorer/box/box.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,6 @@ class BoxChildVisualizer extends StatelessWidget {
377377
final LayoutProperties layoutProperties;
378378
final RenderProperties renderProperties;
379379

380-
LayoutProperties? get root => state.properties;
381-
382380
LayoutProperties? get properties => renderProperties.layoutProperties;
383381

384382
@override

packages/devtools_app/lib/src/screens/inspector/layout_explorer/ui/layout_explorer_widget.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ abstract class LayoutExplorerWidgetState<W extends LayoutExplorerWidget,
8989
/// Whether this layout explorer can work with this kind of node.
9090
bool shouldDisplay(RemoteDiagnosticsNode node);
9191

92-
Size get size => properties!.size;
93-
9492
List<LayoutProperties> get children => properties!.displayChildren;
9593

9694
LayoutProperties? highlighted;

packages/devtools_app/lib/src/screens/inspector/layout_explorer/ui/theme.dart

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ const smallTextScaleFactor = 0.8;
4646
/// Height for limiting asset image (selected one in the drop down).
4747
double get axisAlignmentAssetImageHeight => scaleByFontFactor(24.0);
4848

49-
/// Width for limiting asset image (when drop down menu is open for the vertical).
50-
double get axisAlignmentAssetImageWidth => scaleByFontFactor(96.0);
5149
double get dropdownMaxSize => scaleByFontFactor(220.0);
5250

5351
double get minHeightToAllowTruncating => scaleByFontFactor(375.0);
@@ -56,11 +54,6 @@ double get minWidthToAllowTruncating => scaleByFontFactor(375.0);
5654
// Story of Layout colors
5755
const mainAxisLightColor = Color(0xff2c5daa);
5856
const mainAxisDarkColor = Color(0xff2c5daa);
59-
const rowColor = Color(0xff2c5daa);
60-
const columnColor = Color(0xff77974d);
61-
const regularWidgetColor = Color(0xff88b1de);
62-
63-
const selectedWidgetColor = Color(0xff36c6f4);
6457

6558
const textColor = Color(0xff55767f);
6659
const emphasizedTextColor = Color(0xff009aca);
@@ -108,9 +101,6 @@ extension LayoutExplorerColorScheme on ColorScheme {
108101
Color get backgroundColorSelected =>
109102
isLight ? backgroundColorSelectedLight : backgroundColorSelectedDark;
110103

111-
Color get backgroundColor =>
112-
isLight ? backgroundColorLight : backgroundColorDark;
113-
114104
Color get unconstrainedColor =>
115105
isLight ? unconstrainedLightColor : unconstrainedDarkColor;
116106
}
@@ -124,8 +114,6 @@ const unconstrainedLightColor = Color(0xfff5846b);
124114
const widthIndicatorColor = textColor;
125115
const heightIndicatorColor = textColor;
126116

127-
extension LayoutThemeDataExtension on ThemeData {}
128-
129117
const negativeSpaceDarkAssetName =
130118
'assets/img/layout_explorer/negative_space_dark.png';
131119
const negativeSpaceLightAssetName =

packages/devtools_app/lib/src/screens/inspector/layout_explorer/ui/utils.dart

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,6 @@ class BorderLayout extends StatelessWidget {
5252
final double? topHeight;
5353
final double? bottomHeight;
5454

55-
CrossAxisAlignment get crossAxisAlignment {
56-
if (left != null && right != null) {
57-
return CrossAxisAlignment.center;
58-
} else if (left == null && right != null) {
59-
return CrossAxisAlignment.start;
60-
} else if (left != null && right == null) {
61-
return CrossAxisAlignment.end;
62-
} else {
63-
return CrossAxisAlignment.start;
64-
}
65-
}
66-
6755
@override
6856
Widget build(BuildContext context) {
6957
return Stack(

packages/devtools_app/lib/src/screens/memory/memory_screen.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,7 @@ class MemoryBodyState extends State<MemoryBody>
9696
return Column(
9797
key: MemoryChartPane.hoverKey,
9898
children: [
99-
MemoryControlPane(
100-
chartController: _chartController,
101-
controller: controller,
102-
),
99+
MemoryControlPane(controller: controller),
103100
const SizedBox(height: denseRowSpacing),
104101
MemoryChartPane(
105102
chartController: _chartController,

packages/devtools_app/lib/src/screens/memory/panes/chart/chart_pane_controller.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ class MemoryChartPaneController {
2323

2424
final _legendVisibleNotifier = ValueNotifier<bool>(true);
2525

26-
bool get isLegendVisible => _legendVisibleNotifier.value;
27-
2826
bool toggleLegendVisibility() =>
2927
_legendVisibleNotifier.value = !_legendVisibleNotifier.value;
3028

packages/devtools_app/lib/src/screens/memory/panes/chart/interval_dropdown.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import '../../memory_controller.dart';
1212
import 'chart_pane_controller.dart';
1313
import 'primitives.dart';
1414

15-
const verboseDropDownMinimumWidth = 950;
16-
1715
class IntervalDropdown extends StatefulWidget {
1816
const IntervalDropdown({Key? key, required this.chartController})
1917
: super(key: key);

packages/devtools_app/lib/src/screens/memory/panes/chart/legend.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ class MemoryChartLegend extends StatelessWidget {
5656
LegendRow(
5757
entry1: leftEntry,
5858
entry2: rightEntry,
59-
chartController: chartController,
6059
),
6160
);
6261
}
@@ -73,7 +72,6 @@ class MemoryChartLegend extends StatelessWidget {
7372
legendRows.add(
7473
LegendRow(
7574
entry1: entry,
76-
chartController: chartController,
7775
),
7876
);
7977
}
@@ -91,7 +89,6 @@ class MemoryChartLegend extends StatelessWidget {
9189
legendRows.add(
9290
LegendRow(
9391
entry1: entry,
94-
chartController: chartController,
9592
),
9693
);
9794
}
@@ -119,12 +116,10 @@ class MemoryChartLegend extends StatelessWidget {
119116
class LegendRow extends StatelessWidget {
120117
const LegendRow({
121118
Key? key,
122-
required this.chartController,
123119
required this.entry1,
124120
this.entry2,
125121
}) : super(key: key);
126122

127-
final MemoryChartPaneController chartController;
128123
final MapEntry<String, Map<String, Object?>> entry1;
129124
final MapEntry<String, Map<String, Object?>>? entry2;
130125

packages/devtools_app/lib/src/screens/memory/panes/control/control_pane.dart

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,15 @@
55
import 'package:flutter/material.dart';
66

77
import '../../memory_controller.dart';
8-
import '../chart/chart_pane_controller.dart';
98
import 'primary_controls.dart';
109
import 'secondary_controls.dart';
1110

1211
class MemoryControlPane extends StatelessWidget {
1312
const MemoryControlPane({
1413
Key? key,
15-
required this.chartController,
1614
required this.controller,
1715
}) : super(key: key);
1816

19-
final MemoryChartPaneController chartController;
2017
final MemoryController controller;
2118

2219
@override
@@ -26,10 +23,7 @@ class MemoryControlPane extends StatelessWidget {
2623
children: [
2724
const PrimaryControls(),
2825
const Spacer(),
29-
SecondaryControls(
30-
chartController: chartController,
31-
controller: controller,
32-
),
26+
SecondaryControls(controller: controller),
3327
],
3428
);
3529
}

packages/devtools_app/lib/src/screens/memory/panes/control/primitives.dart

Lines changed: 0 additions & 9 deletions
This file was deleted.

packages/devtools_app/lib/src/screens/memory/panes/control/secondary_controls.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,15 @@ import '../../../../shared/common_widgets.dart';
1212
import '../../../../shared/theme.dart';
1313
import '../../memory_controller.dart';
1414
import '../../shared/primitives/simple_elements.dart';
15-
import '../chart/chart_pane_controller.dart';
1615
import 'settings_dialog.dart';
1716

1817
/// Controls related to the entire memory screen.
1918
class SecondaryControls extends StatelessWidget {
2019
const SecondaryControls({
2120
Key? key,
22-
required this.chartController,
2321
required this.controller,
2422
}) : super(key: key);
2523

26-
final MemoryChartPaneController chartController;
2724
final MemoryController controller;
2825

2926
@override
@@ -55,7 +52,7 @@ class SecondaryControls extends StatelessWidget {
5552
unawaited(
5653
showDialog(
5754
context: context,
58-
builder: (context) => MemorySettingsDialog(controller),
55+
builder: (context) => const MemorySettingsDialog(),
5956
),
6057
);
6158
}

0 commit comments

Comments
 (0)