Skip to content

Commit 506141e

Browse files
Remove unused code in integration_test and shared (#9916)
1 parent 1681401 commit 506141e

72 files changed

Lines changed: 322 additions & 2041 deletions

File tree

Some content is hidden

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

analysis_options.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,11 @@ dart_code_metrics:
170170
# devtools_app/.
171171
# TODO(https://github.com/flutter/devtools/issues/9906) remove these
172172
# excludes as findings are resolved.
173-
- integration_test/**
174-
# Investigate internal usages of inspector_controller before removing.
173+
# Investigate internal usages of inspector logic before removing.
175174
- lib/src/screens/inspector/**_controller.dart
176-
- lib/src/shared/**
175+
- lib/src/shared/diagnostics/inspector_service.dart
176+
- lib/src/shared/diagnostics/diagnostics_node.dart
177+
177178
- test/**
178179
rules:
179180
# - arguments-ordering Too strict

packages/devtools_app/benchmark/devtools_benchmarks_test.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
// Note: this test was modeled after the example test from Flutter Gallery:
66
// https://github.com/flutter/gallery/blob/master/test_benchmarks/benchmarks_test.dart
77

8-
import 'dart:convert' show JsonEncoder;
98
import 'dart:io';
109

1110
import 'package:collection/collection.dart';
11+
import 'package:devtools_app/src/shared/primitives/utils.dart';
1212
import 'package:devtools_test/helpers.dart';
1313
import 'package:test/test.dart';
1414
import 'package:web_benchmarks/metrics.dart';
@@ -92,10 +92,7 @@ Future<void> _runBenchmarks({bool useWasm = false}) async {
9292

9393
stdout.writeln('Web benchmark tests finished.');
9494

95-
expect(
96-
const JsonEncoder.withIndent(' ').convert(taskResult.toJson()),
97-
isA<String>(),
98-
);
95+
expect(prettyPrintJson(taskResult.toJson()), isA<String>());
9996
expect(taskResult.scores.keys, hasLength(DevToolsBenchmark.values.length));
10097

10198
for (final devToolsBenchmark in DevToolsBenchmark.values) {

packages/devtools_app/benchmark/scripts/compare_benchmarks.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import 'dart:convert';
66
import 'dart:io';
77

8+
import 'package:devtools_app/src/shared/primitives/utils.dart';
89
import 'package:web_benchmarks/analysis.dart';
910

1011
import 'utils.dart';
@@ -61,6 +62,6 @@ void compareBenchmarks(
6162
stdout.writeln('Baseline comparison finished.');
6263
stdout
6364
..writeln('==== Comparison with baseline $baselineSource ====')
64-
..writeln(const JsonEncoder.withIndent(' ').convert(delta.toJson()))
65+
..writeln(prettyPrintJson(delta.toJson()))
6566
..writeln('==== End of baseline comparison ====');
6667
}

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
@@ -389,11 +389,9 @@ final class FlutterDaemonConstants {
389389
static const paramsKey = 'params';
390390
static const traceKey = 'trace';
391391
static const wsUriKey = 'wsUri';
392-
static const pidKey = 'pid';
393392
static const appStopKey = 'app.stop';
394393
static const appStartedKey = 'app.started';
395394
static const appDebugPortKey = 'app.debugPort';
396-
static const daemonConnectedKey = 'daemon.connected';
397395
}
398396

399397
enum TestAppDevice {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
44

55
import 'dart:collection';
6-
import 'dart:convert';
76

87
import 'package:collection/collection.dart';
98
import 'package:string_scanner/string_scanner.dart';
109

10+
import '../../shared/primitives/utils.dart';
11+
1112
//TODO(jacobr): cleanup.
1213
/// A namespace for [SpanParser] utilities.
1314
extension SpanParser on Never {
@@ -68,7 +69,7 @@ class Grammar {
6869

6970
@override
7071
String toString() {
71-
return const JsonEncoder.withIndent(' ').convert({
72+
return prettyPrintJson({
7273
'name': name,
7374
'scopeName': scopeName,
7475
'topLevelMatcher': topLevelMatcher.toJson(),

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

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ class InspectorTreeController extends DisposableController
120120
/// [InspectorTreeController].
121121
final int? gaId;
122122

123-
InspectorTreeNode createNode() =>
124-
InspectorTreeNode(whenDirty: _handleDirtyNode);
123+
InspectorTreeNode createNode() => InspectorTreeNode();
125124

126125
SearchTargetType _searchTarget = SearchTargetType.widget;
127126
int _rootSetCount = 0;
@@ -284,15 +283,6 @@ class InspectorTreeController extends DisposableController
284283
}
285284
}
286285

287-
/// Resets the state if the root has been marked as dirty.
288-
void _handleDirtyNode(InspectorTreeNode node) {
289-
if (node == root) {
290-
_cachedSelectedRow = null;
291-
lastContentWidth = null;
292-
_updateRows();
293-
}
294-
}
295-
296286
void setSearchTarget(SearchTargetType searchTarget) {
297287
_searchTarget = searchTarget;
298288
refreshSearchMatches();
@@ -448,10 +438,6 @@ class InspectorTreeController extends DisposableController
448438
return inspectorRowHeight * index;
449439
}
450440

451-
void nodeChanged(InspectorTreeNode node) {
452-
node.isDirty = true;
453-
}
454-
455441
void removeNodeFromParent(InspectorTreeNode node) {
456442
node.parent?.removeChild(node);
457443
}
@@ -767,7 +753,6 @@ class InspectorTreeController extends DisposableController
767753
setupChildren(diagnostic, treeNode, children, expandChildren: true);
768754
refreshTree(
769755
updateTreeAction: () {
770-
nodeChanged(treeNode);
771756
if (treeNode == selection) {
772757
expandPath(treeNode);
773758
}

packages/devtools_app/lib/src/screens/logging/logging_controller.dart

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,8 +1016,6 @@ class LogData with SearchableDataMixin {
10161016
String? _details;
10171017
Future<String> Function()? detailsComputer;
10181018

1019-
static const prettyPrinter = JsonEncoder.withIndent(' ');
1020-
10211019
String? get details => _details;
10221020

10231021
bool get needsComputing => !detailsComputed.isCompleted;
@@ -1040,10 +1038,9 @@ class LogData with SearchableDataMixin {
10401038
}
10411039

10421040
try {
1043-
return prettyPrinter
1044-
.convert(jsonDecode(details!))
1045-
.replaceAll(r'\n', '\n')
1046-
.trim();
1041+
return prettyPrintJson(
1042+
jsonDecode(details!) as Object?,
1043+
).replaceAll(r'\n', '\n').trim();
10471044
} catch (_) {
10481045
return details?.trim();
10491046
}

packages/devtools_app/lib/src/shared/analytics/_analytics_web.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
44

55
// ignore_for_file: non_constant_identifier_names
6+
// ignore_for_file: unused-code, platform specific imports.
67

78
import 'dart:async';
89

packages/devtools_app/lib/src/shared/analytics/analytics_controller.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ bool get isAnalyticsEnabled =>
4343
/// Whether the analytics controller has been initialized.
4444
bool get isAnalyticsControllerInitialized => _analyticsController != null;
4545

46-
typedef AsyncAnalyticsCallback = FutureOr<void> Function();
47-
4846
class AnalyticsController {
4947
AnalyticsController({
5048
required bool enabled,
@@ -67,6 +65,7 @@ class AnalyticsController {
6765
ValueListenable<bool> get shouldPrompt => _shouldPrompt;
6866
final ValueNotifier<bool> _shouldPrompt;
6967

68+
@visibleForTesting
7069
bool get analyticsInitialized => _analyticsInitialized;
7170
bool _analyticsInitialized = false;
7271

packages/devtools_app/lib/src/shared/analytics/constants.dart

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ const slowAnimation = 'slowAnimation';
8585
const slowAnimationDocs = 'slowAnimationDocs';
8686
const repaintRainbow = 'repaintRainbow';
8787
const repaintRainbowDocs = 'repaintRainbowDocs';
88-
const debugBanner = 'debugBanner';
8988
const togglePlatform = 'togglePlatform';
9089
const brightnessOverride = 'brightnessOverride';
9190
const highlightOversizedImages = 'highlightOversizedImages';
@@ -99,13 +98,6 @@ const inspectorSettings = 'inspectorSettings';
9998
const loggingSettings = 'loggingSettings';
10099
const refreshPubRoots = 'refreshPubRoots';
101100

102-
enum InspectorDetailsViewType { layoutExplorer, widgetDetailsTree }
103-
104-
final defaultDetailsViewToLayoutExplorer =
105-
InspectorDetailsViewType.layoutExplorer.name;
106-
final defaultDetailsViewToWidgetDetails =
107-
InspectorDetailsViewType.widgetDetailsTree.name;
108-
109101
enum HomeScreenEvents { connectToApp, connectToNewApp, viewVmFlags }
110102

111103
// Logging UX actions:

0 commit comments

Comments
 (0)