Remove unused code from `services/` (#9919)
diff --git a/analysis_options.yaml b/analysis_options.yaml index b6c61e1..117473a 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml
@@ -18,6 +18,13 @@ - '**/build/**' - '**.freezed.dart' - tool/flutter-sdk/ + - build/** + - android/** + - ios/** + - web/** + - windows/** + - macos/** + - linux/** linter: rules: @@ -166,7 +173,6 @@ - integration_test/** # Investigate internal usages of inspector_controller before removing. - lib/src/screens/inspector/**_controller.dart - - lib/src/service/** - lib/src/shared/** - test/** rules:
diff --git a/packages/devtools_app/analysis_options.yaml b/packages/devtools_app/analysis_options.yaml index e85c2e1..1fb0989 100644 --- a/packages/devtools_app/analysis_options.yaml +++ b/packages/devtools_app/analysis_options.yaml
@@ -13,6 +13,12 @@ # these files if you want to ensure code is not invalid except where # expected. - test/test_infra/test_data/syntax_highlighting/** + - android/** + - ios/** + - web/** + - windows/** + - macos/** + - linux/** dart_code_metrics: metrics-exclude:
diff --git a/packages/devtools_app/lib/src/service/service_extensions.dart b/packages/devtools_app/lib/src/service/service_extensions.dart index b2bf785..c4fd56a 100644 --- a/packages/devtools_app/lib/src/service/service_extensions.dart +++ b/packages/devtools_app/lib/src/service/service_extensions.dart
@@ -226,15 +226,6 @@ String get gaItemTooltipLink => '${gaItem}TooltipLink'; } -final debugAllowBanner = ToggleableServiceExtensionDescription<bool>.from( - extensions.debugAllowBanner, - title: 'Debug Banner', - iconAsset: 'icons/debug_banner@2x.png', - gaScreenName: gac.inspector, - gaItem: gac.debugBanner, - tooltip: 'Toggle Debug Banner', -); - final invertOversizedImages = ToggleableServiceExtensionDescription<bool>.from( extensions.invertOversizedImages, title: 'Highlight Oversized Images', @@ -363,6 +354,8 @@ gaDocsItem: gac.slowAnimationDocs, ); +// TODO(https://github.com/flutter/devtools/issues/2780): hook this up in the UI. +// ignore: unused-code, TODO(https://github.com/flutter/devtools/issues/2780). final togglePlatformMode = ServiceExtensionDescription<String>.from( extensions.togglePlatformMode, title: 'Override target platform',
diff --git a/packages/devtools_app/lib/src/service/timeline_streams.dart b/packages/devtools_app/lib/src/service/timeline_streams.dart index 57e51d1..6d669a1 100644 --- a/packages/devtools_app/lib/src/service/timeline_streams.dart +++ b/packages/devtools_app/lib/src/service/timeline_streams.dart
@@ -63,6 +63,7 @@ List<TimelineStream> get advancedStreams => _streamsWhere((stream) => stream.advanced); + @visibleForTesting List<TimelineStream> get recordedStreams => _streamsWhere((stream) => stream.recorded.value);
diff --git a/packages/devtools_app/lib/src/service/vm_service_wrapper.dart b/packages/devtools_app/lib/src/service/vm_service_wrapper.dart index a49971f..87724a9 100644 --- a/packages/devtools_app/lib/src/service/vm_service_wrapper.dart +++ b/packages/devtools_app/lib/src/service/vm_service_wrapper.dart
@@ -94,8 +94,9 @@ final _activeStreams = <String, Future<Success>>{}; - final activeFutures = <TrackedFuture<Object>>{}; + final activeFutureNames = <String>[]; + @visibleForTesting Future<void> get allFuturesCompleted => _allFuturesCompleter.future; Completer<bool> _allFuturesCompleter = Completer<bool>() @@ -326,20 +327,6 @@ // End Dart IO extension method wrappers. - /// Testing only method to indicate that we don't really need to await all - /// currently pending futures. - /// - /// If you use this method be sure to indicate why you believe all pending - /// futures are safe to ignore. Currently the theory is this method should be - /// used after a hot restart to avoid bugs where we have zombie futures lying - /// around causing tests to flake. - @visibleForTesting - void doNotWaitForPendingFuturesBeforeExit() { - _allFuturesCompleter = Completer<bool>(); - _allFuturesCompleter.complete(true); - activeFutures.clear(); - } - @visibleForTesting int vmServiceCallCount = 0; @@ -383,15 +370,14 @@ vmServiceCallCount++; vmServiceCalls.add(name); - final trackedFuture = TrackedFuture(name, localFuture as Future<Object>); if (_allFuturesCompleter.isCompleted) { _allFuturesCompleter = Completer<bool>(); } - activeFutures.add(trackedFuture); + activeFutureNames.add(name); void futureComplete() { - activeFutures.remove(trackedFuture); - if (activeFutures.isEmpty) { + activeFutureNames.remove(name); + if (activeFutureNames.isEmpty) { _allFuturesCompleter.safeComplete(true); } } @@ -428,10 +414,6 @@ return parser(result.json); } - /// Forces the VM to perform a full garbage collection. - Future<Success?> collectAllGarbage() => - _privateRpcInvoke('collectAllGarbage', parser: Success.parse); - Future<InstanceRef?> getReachableSize(String isolateId, String targetId) => _privateRpcInvoke( 'getReachableSize', @@ -512,10 +494,3 @@ return response.dapResponse.body; } } - -class TrackedFuture<T> { - TrackedFuture(this.name, this.future); - - final String name; - final Future<T> future; -}
diff --git a/packages/devtools_app/test/test_infra/flutter_test_environment.dart b/packages/devtools_app/test/test_infra/flutter_test_environment.dart index 54da10a..812853c 100644 --- a/packages/devtools_app/test/test_infra/flutter_test_environment.dart +++ b/packages/devtools_app/test/test_infra/flutter_test_environment.dart
@@ -200,8 +200,8 @@ const Duration(seconds: 20), onTimeout: () { throw 'Timed out waiting for futures to complete during teardown. ' - '${_service.activeFutures.length} futures remained:\n\n' - ' ${_service.activeFutures.map((tf) => tf.name).join('\n ')}'; + '${_service.activeFutureNames.length} futures remained:\n\n' + ' ${_service.activeFutureNames.join('\\n ')}'; }, ); await _flutter!.stop();
diff --git a/packages/devtools_extensions/example/app_that_uses_foo/analysis_options.yaml b/packages/devtools_extensions/example/app_that_uses_foo/analysis_options.yaml index 0d29021..bf8d421 100644 --- a/packages/devtools_extensions/example/app_that_uses_foo/analysis_options.yaml +++ b/packages/devtools_extensions/example/app_that_uses_foo/analysis_options.yaml
@@ -7,6 +7,15 @@ # The following line activates a set of recommended lints for Flutter apps, # packages, and plugins designed to encourage good coding practices. +analyzer: + exclude: + - build/** + - android/** + - ios/** + - web/** + - windows/** + - macos/** + - linux/** include: package:flutter_lints/flutter.yaml linter:
diff --git a/third_party/packages/widget_icons/analysis_options.yaml b/third_party/packages/widget_icons/analysis_options.yaml index f9b3034..743e05a 100644 --- a/third_party/packages/widget_icons/analysis_options.yaml +++ b/third_party/packages/widget_icons/analysis_options.yaml
@@ -1 +1,10 @@ +analyzer: + exclude: + - build/** + - android/** + - ios/** + - web/** + - windows/** + - macos/** + - linux/** include: package:flutter_lints/flutter.yaml
diff --git a/third_party/packages/widget_icons/example/analysis_options.yaml b/third_party/packages/widget_icons/example/analysis_options.yaml index f9b3034..743e05a 100644 --- a/third_party/packages/widget_icons/example/analysis_options.yaml +++ b/third_party/packages/widget_icons/example/analysis_options.yaml
@@ -1 +1,10 @@ +analyzer: + exclude: + - build/** + - android/** + - ios/** + - web/** + - windows/** + - macos/** + - linux/** include: package:flutter_lints/flutter.yaml
diff --git a/tool/analysis_options.yaml b/tool/analysis_options.yaml index 81588d9..f4ded48 100644 --- a/tool/analysis_options.yaml +++ b/tool/analysis_options.yaml
@@ -6,6 +6,13 @@ analyzer: exclude: - flutter-sdk/ + - build/** + - android/** + - ios/** + - web/** + - windows/** + - macos/** + - linux/** linter: rules: