Skip to content

Commit df811c6

Browse files
authored
Remove unused getRootRenderObject and getSelectedRenderObject service extensions (flutter#124805)
These are currently unused and will not work in a multi-view environment where we will have multiple render trees. Work towards flutter#121573.
1 parent b6c7df4 commit df811c6

File tree

3 files changed

+1
-59
lines changed

3 files changed

+1
-59
lines changed

packages/flutter/lib/src/widgets/service_extensions.dart

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -351,17 +351,6 @@ enum WidgetInspectorServiceExtensions {
351351
/// extension is registered.
352352
getRootWidget,
353353

354-
/// Name of service extension that, when called, will return the
355-
/// [DiagnosticsNode] data for the root [RenderObject].
356-
///
357-
/// See also:
358-
///
359-
/// * [WidgetInspectorService.getRootRenderObject], which returns a json
360-
/// encoded String representation of this data.
361-
/// * [WidgetInspectorService.initServiceExtensions], where the service
362-
/// extension is registered.
363-
getRootRenderObject,
364-
365354
/// Name of service extension that, when called, will return the
366355
/// [DiagnosticsNode] data for the root [Element] of the summary tree, which
367356
/// only includes [Element]s that were created by user code.
@@ -403,17 +392,6 @@ enum WidgetInspectorServiceExtensions {
403392
/// extension is registered.
404393
getDetailsSubtree,
405394

406-
/// Name of service extension that, when called, will return the
407-
/// [DiagnosticsNode] data for the currently selected [RenderObject].
408-
///
409-
/// See also:
410-
///
411-
/// * [WidgetInspectorService.getSelectedRenderObject], which returns a json
412-
/// encoded String representation of this data.
413-
/// * [WidgetInspectorService.initServiceExtensions], where the service
414-
/// extension is registered.
415-
getSelectedRenderObject,
416-
417395
/// Name of service extension that, when called, will return the
418396
/// [DiagnosticsNode] data for the currently selected [Element].
419397
///

packages/flutter/lib/src/widgets/widget_inspector.dart

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,10 +1153,6 @@ mixin WidgetInspectorService {
11531153
name: WidgetInspectorServiceExtensions.getRootWidget.name,
11541154
callback: _getRootWidget,
11551155
);
1156-
_registerObjectGroupServiceExtension(
1157-
name: WidgetInspectorServiceExtensions.getRootRenderObject.name,
1158-
callback: _getRootRenderObject,
1159-
);
11601156
_registerObjectGroupServiceExtension(
11611157
name: WidgetInspectorServiceExtensions.getRootWidgetSummaryTree.name,
11621158
callback: _getRootWidgetSummaryTree,
@@ -1179,10 +1175,6 @@ mixin WidgetInspectorService {
11791175
};
11801176
},
11811177
);
1182-
_registerServiceExtensionWithArg(
1183-
name: WidgetInspectorServiceExtensions.getSelectedRenderObject.name,
1184-
callback: _getSelectedRenderObject,
1185-
);
11861178
_registerServiceExtensionWithArg(
11871179
name: WidgetInspectorServiceExtensions.getSelectedWidget.name,
11881180
callback: _getSelectedWidget,
@@ -1881,17 +1873,6 @@ mixin WidgetInspectorService {
18811873
});
18821874
}
18831875

1884-
/// Returns a JSON representation of the [DiagnosticsNode] for the root
1885-
/// [RenderObject].
1886-
@protected
1887-
String getRootRenderObject(String groupName) {
1888-
return _safeJsonEncode(_getRootRenderObject(groupName));
1889-
}
1890-
1891-
Map<String, Object?>? _getRootRenderObject(String groupName) {
1892-
return _nodeToJson(RendererBinding.instance.renderView.toDiagnosticsNode(), InspectorSerializationDelegate(groupName: groupName, service: this));
1893-
}
1894-
18951876
/// Returns a JSON representation of the subtree rooted at the
18961877
/// [DiagnosticsNode] object that `diagnosticsNodeId` references providing
18971878
/// information needed for the details subtree view.
@@ -1932,23 +1913,6 @@ mixin WidgetInspectorService {
19321913
);
19331914
}
19341915

1935-
/// Returns a [DiagnosticsNode] representing the currently selected
1936-
/// [RenderObject].
1937-
///
1938-
/// If the currently selected [RenderObject] is identical to the
1939-
/// [RenderObject] referenced by `previousSelectionId` then the previous
1940-
/// [DiagnosticsNode] is reused.
1941-
@protected
1942-
String getSelectedRenderObject(String previousSelectionId, String groupName) {
1943-
return _safeJsonEncode(_getSelectedRenderObject(previousSelectionId, groupName));
1944-
}
1945-
1946-
Map<String, Object?>? _getSelectedRenderObject(String? previousSelectionId, String groupName) {
1947-
final DiagnosticsNode? previousSelection = toObject(previousSelectionId) as DiagnosticsNode?;
1948-
final RenderObject? current = selection.current;
1949-
return _nodeToJson(current == previousSelection?.value ? previousSelection : current?.toDiagnosticsNode(), InspectorSerializationDelegate(groupName: groupName, service: this));
1950-
}
1951-
19521916
/// Returns a [DiagnosticsNode] representing the currently selected [Element].
19531917
///
19541918
/// If the currently selected [Element] is identical to the [Element]

packages/flutter/test/foundation/service_extensions_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void main() {
154154
tearDownAll(() async {
155155
// See widget_inspector_test.dart for tests of the ext.flutter.inspector
156156
// service extensions included in this count.
157-
int widgetInspectorExtensionCount = 22;
157+
int widgetInspectorExtensionCount = 20;
158158
if (WidgetInspectorService.instance.isWidgetCreationTracked()) {
159159
// Some inspector extensions are only exposed if widget creation locations
160160
// are tracked.

0 commit comments

Comments
 (0)