@@ -1722,8 +1722,8 @@ mixin WidgetInspectorService {
17221722 return _safeJsonEncode (_getProperties (diagnosticsNodeId, groupName));
17231723 }
17241724
1725- List <Object > _getProperties (String ? diagnosticsOrDiagnosticableId , String groupName) {
1726- final DiagnosticsNode ? node = _idToDiagnosticsNode (diagnosticsOrDiagnosticableId );
1725+ List <Object > _getProperties (String ? diagnosticableId , String groupName) {
1726+ final DiagnosticsNode ? node = _idToDiagnosticsNode (diagnosticableId );
17271727 if (node == null ) {
17281728 return const < Object > [];
17291729 }
@@ -1760,28 +1760,22 @@ mixin WidgetInspectorService {
17601760 return _safeJsonEncode (_getChildrenSummaryTree (diagnosticsNodeId, groupName));
17611761 }
17621762
1763- DiagnosticsNode ? _idToDiagnosticsNode (String ? diagnosticsOrDiagnosticableId) {
1764- // TODO(polina-c): start always assuming Diagnosticable, when DevTools stops sending DiagnosticsNode to
1765- // APIs that invoke this method.
1766- // https://github.com/flutter/devtools/issues/3951
1767- final Object ? object = toObject (diagnosticsOrDiagnosticableId);
1763+ DiagnosticsNode ? _idToDiagnosticsNode (String ? diagnosticableId) {
1764+ final Object ? object = toObject (diagnosticableId);
17681765 return objectToDiagnosticsNode (object);
17691766 }
17701767
1771- /// If posiible , returns [DiagnosticsNode] for the object.
1768+ /// If possible , returns [DiagnosticsNode] for the object.
17721769 @visibleForTesting
17731770 static DiagnosticsNode ? objectToDiagnosticsNode (Object ? object) {
1774- if (object is DiagnosticsNode ) {
1775- return object;
1776- }
17771771 if (object is Diagnosticable ) {
17781772 return object.toDiagnosticsNode ();
17791773 }
17801774 return null ;
17811775 }
17821776
1783- List <Object > _getChildrenSummaryTree (String ? diagnosticsOrDiagnosticableId , String groupName) {
1784- final DiagnosticsNode ? node = _idToDiagnosticsNode (diagnosticsOrDiagnosticableId );
1777+ List <Object > _getChildrenSummaryTree (String ? diagnosticableId , String groupName) {
1778+ final DiagnosticsNode ? node = _idToDiagnosticsNode (diagnosticableId );
17851779 if (node == null ) {
17861780 return < Object > [];
17871781 }
@@ -1791,17 +1785,17 @@ mixin WidgetInspectorService {
17911785 }
17921786
17931787 /// Returns a JSON representation of the children of the [DiagnosticsNode]
1794- /// object that [diagnosticsOrDiagnosticableId ] references providing information needed
1788+ /// object that [diagnosticableId ] references providing information needed
17951789 /// for the details subtree view.
17961790 ///
17971791 /// The details subtree shows properties inline and includes all children
17981792 /// rather than a filtered set of important children.
1799- String getChildrenDetailsSubtree (String diagnosticsOrDiagnosticableId , String groupName) {
1800- return _safeJsonEncode (_getChildrenDetailsSubtree (diagnosticsOrDiagnosticableId , groupName));
1793+ String getChildrenDetailsSubtree (String diagnosticableId , String groupName) {
1794+ return _safeJsonEncode (_getChildrenDetailsSubtree (diagnosticableId , groupName));
18011795 }
18021796
1803- List <Object > _getChildrenDetailsSubtree (String ? diagnosticsOrDiagnosticableId , String groupName) {
1804- final DiagnosticsNode ? node = _idToDiagnosticsNode (diagnosticsOrDiagnosticableId );
1797+ List <Object > _getChildrenDetailsSubtree (String ? diagnosticableId , String groupName) {
1798+ final DiagnosticsNode ? node = _idToDiagnosticsNode (diagnosticableId );
18051799 // With this value of minDepth we only expand one extra level of important nodes.
18061800 final InspectorSerializationDelegate delegate = InspectorSerializationDelegate (groupName: groupName, includeProperties: true , service: this );
18071801 return _nodesToJson (node == null ? const < DiagnosticsNode > [] : _getChildrenFiltered (node, delegate), delegate, parent: node);
@@ -1913,19 +1907,19 @@ mixin WidgetInspectorService {
19131907 /// * [getChildrenDetailsSubtree] , a method to get children of a node
19141908 /// in the details subtree.
19151909 String getDetailsSubtree (
1916- String diagnosticsOrDiagnosticableId ,
1910+ String diagnosticableId ,
19171911 String groupName, {
19181912 int subtreeDepth = 2 ,
19191913 }) {
1920- return _safeJsonEncode (_getDetailsSubtree (diagnosticsOrDiagnosticableId , groupName, subtreeDepth));
1914+ return _safeJsonEncode (_getDetailsSubtree (diagnosticableId , groupName, subtreeDepth));
19211915 }
19221916
19231917 Map <String , Object ?>? _getDetailsSubtree (
1924- String ? diagnosticsOrDiagnosticableId ,
1918+ String ? diagnosticableId ,
19251919 String ? groupName,
19261920 int subtreeDepth,
19271921 ) {
1928- final DiagnosticsNode ? root = _idToDiagnosticsNode (diagnosticsOrDiagnosticableId );
1922+ final DiagnosticsNode ? root = _idToDiagnosticsNode (diagnosticableId );
19291923 if (root == null ) {
19301924 return null ;
19311925 }
@@ -1941,15 +1935,12 @@ mixin WidgetInspectorService {
19411935 }
19421936
19431937 /// Returns a [DiagnosticsNode] representing the currently selected [Element] .
1944- ///
1945- /// If the currently selected [Element] is identical to the [Element]
1946- /// referenced by `previousSelectionId` then the previous [DiagnosticsNode] is
1947- /// reused.
1948- // TODO(polina-c): delete [previousSelectionId] when it is not used in DevTools
1949- // https://github.com/flutter/devtools/issues/3951
19501938 @protected
19511939 String getSelectedWidget (String ? previousSelectionId, String groupName) {
1952- return _safeJsonEncode (_getSelectedWidget (previousSelectionId, groupName));
1940+ if (previousSelectionId != null ) {
1941+ debugPrint ('previousSelectionId is deprecated in API' );
1942+ }
1943+ return _safeJsonEncode (_getSelectedWidget (null , groupName));
19531944 }
19541945
19551946 /// Captures an image of the current state of an [object] that is a
@@ -2025,11 +2016,11 @@ mixin WidgetInspectorService {
20252016 Future <Map <String , Object ?>> _getLayoutExplorerNode (
20262017 Map <String , String > parameters,
20272018 ) {
2028- final String ? diagnosticsOrDiagnosticableId = parameters['id' ];
2019+ final String ? diagnosticableId = parameters['id' ];
20292020 final int subtreeDepth = int .parse (parameters['subtreeDepth' ]! );
20302021 final String ? groupName = parameters['groupName' ];
20312022 Map <String , dynamic >? result = < String , dynamic > {};
2032- final DiagnosticsNode ? root = _idToDiagnosticsNode (diagnosticsOrDiagnosticableId );
2023+ final DiagnosticsNode ? root = _idToDiagnosticsNode (diagnosticableId );
20332024 if (root == null ) {
20342025 return Future <Map <String , dynamic >>.value (< String , dynamic > {
20352026 'result' : result,
@@ -2233,14 +2224,11 @@ mixin WidgetInspectorService {
22332224 /// if the selected [Element] should be shown in the summary tree otherwise
22342225 /// returns the first ancestor of the selected [Element] shown in the summary
22352226 /// tree.
2236- ///
2237- /// If the currently selected [Element] is identical to the [Element]
2238- /// referenced by `previousSelectionId` then the previous [DiagnosticsNode] is
2239- /// reused.
2240- // TODO(polina-c): delete paramater [previousSelectionId] when it is not used in DevTools
2241- // https://github.com/flutter/devtools/issues/3951
2242- String getSelectedSummaryWidget (String previousSelectionId, String groupName) {
2243- return _safeJsonEncode (_getSelectedSummaryWidget (previousSelectionId, groupName));
2227+ String getSelectedSummaryWidget (String ? previousSelectionId, String groupName) {
2228+ if (previousSelectionId != null ) {
2229+ debugPrint ('previousSelectionId is deprecated in API' );
2230+ }
2231+ return _safeJsonEncode (_getSelectedSummaryWidget (null , groupName));
22442232 }
22452233
22462234 _Location ? _getSelectedSummaryWidgetLocation (String ? previousSelectionId) {
@@ -3609,7 +3597,6 @@ class InspectorSerializationDelegate implements DiagnosticsSerializationDelegate
36093597 final Map <String , Object ?> result = < String , Object ? > {};
36103598 final Object ? value = node.value;
36113599 if (_interactive) {
3612- result['objectId' ] = service.toId (node, groupName! );
36133600 result['valueId' ] = service.toId (value, groupName! );
36143601 }
36153602 if (summaryTree) {
0 commit comments