@@ -2038,90 +2038,90 @@ mixin WidgetInspectorService {
2038
2038
subtreeDepth: subtreeDepth,
2039
2039
service: this ,
2040
2040
addAdditionalPropertiesCallback: (DiagnosticsNode node, InspectorSerializationDelegate delegate) {
2041
- final Map <String , Object > additionalJson = < String , Object > {};
2042
2041
final Object ? value = node.value;
2043
- if (value is Element ) {
2044
- final RenderObject ? renderObject = value.renderObject;
2045
- if (renderObject != null ) {
2046
- additionalJson['renderObject' ] =
2047
- renderObject.toDiagnosticsNode ().toJsonMap (
2042
+ final RenderObject ? renderObject = value is Element ? value.renderObject : null ;
2043
+ if (renderObject == null ) {
2044
+ return const < String , Object > {};
2045
+ }
2046
+
2047
+ final DiagnosticsSerializationDelegate renderObjectSerializationDelegate = delegate.copyWith (
2048
+ subtreeDepth: 0 ,
2049
+ includeProperties: true ,
2050
+ expandPropertyValues: false ,
2051
+ );
2052
+ final Map <String , Object > additionalJson = < String , Object > {
2053
+ 'renderObject' : renderObject.toDiagnosticsNode ().toJsonMap (renderObjectSerializationDelegate),
2054
+ };
2055
+
2056
+ final AbstractNode ? renderParent = renderObject.parent;
2057
+ if (renderParent is RenderObject && subtreeDepth > 0 ) {
2058
+ final Object ? parentCreator = renderParent.debugCreator;
2059
+ if (parentCreator is DebugCreator ) {
2060
+ additionalJson['parentRenderElement' ] =
2061
+ parentCreator.element.toDiagnosticsNode ().toJsonMap (
2048
2062
delegate.copyWith (
2049
2063
subtreeDepth: 0 ,
2050
2064
includeProperties: true ,
2051
2065
),
2052
2066
);
2067
+ // TODO(jacobr): also describe the path back up the tree to
2068
+ // the RenderParentElement from the current element. It
2069
+ // could be a surprising distance up the tree if a lot of
2070
+ // elements don't have their own RenderObjects.
2071
+ }
2072
+ }
2053
2073
2054
- final AbstractNode ? renderParent = renderObject.parent;
2055
- if (renderParent is RenderObject && subtreeDepth > 0 ) {
2056
- final Object ? parentCreator = renderParent.debugCreator;
2057
- if (parentCreator is DebugCreator ) {
2058
- additionalJson['parentRenderElement' ] =
2059
- parentCreator.element.toDiagnosticsNode ().toJsonMap (
2060
- delegate.copyWith (
2061
- subtreeDepth: 0 ,
2062
- includeProperties: true ,
2063
- ),
2064
- );
2065
- // TODO(jacobr): also describe the path back up the tree to
2066
- // the RenderParentElement from the current element. It
2067
- // could be a surprising distance up the tree if a lot of
2068
- // elements don't have their own RenderObjects.
2069
- }
2070
- }
2071
-
2072
- try {
2073
- if (! renderObject.debugNeedsLayout) {
2074
- // ignore: invalid_use_of_protected_member
2075
- final Constraints constraints = renderObject.constraints;
2076
- final Map <String , Object >constraintsProperty = < String , Object > {
2077
- 'type' : constraints.runtimeType.toString (),
2078
- 'description' : constraints.toString (),
2079
- };
2080
- if (constraints is BoxConstraints ) {
2081
- constraintsProperty.addAll (< String , Object > {
2082
- 'minWidth' : constraints.minWidth.toString (),
2083
- 'minHeight' : constraints.minHeight.toString (),
2084
- 'maxWidth' : constraints.maxWidth.toString (),
2085
- 'maxHeight' : constraints.maxHeight.toString (),
2086
- });
2087
- }
2088
- additionalJson['constraints' ] = constraintsProperty;
2089
- }
2090
- } catch (e) {
2091
- // Constraints are sometimes unavailable even though
2092
- // debugNeedsLayout is false.
2074
+ try {
2075
+ if (! renderObject.debugNeedsLayout) {
2076
+ // ignore: invalid_use_of_protected_member
2077
+ final Constraints constraints = renderObject.constraints;
2078
+ final Map <String , Object >constraintsProperty = < String , Object > {
2079
+ 'type' : constraints.runtimeType.toString (),
2080
+ 'description' : constraints.toString (),
2081
+ };
2082
+ if (constraints is BoxConstraints ) {
2083
+ constraintsProperty.addAll (< String , Object > {
2084
+ 'minWidth' : constraints.minWidth.toString (),
2085
+ 'minHeight' : constraints.minHeight.toString (),
2086
+ 'maxWidth' : constraints.maxWidth.toString (),
2087
+ 'maxHeight' : constraints.maxHeight.toString (),
2088
+ });
2093
2089
}
2090
+ additionalJson['constraints' ] = constraintsProperty;
2091
+ }
2092
+ } catch (e) {
2093
+ // Constraints are sometimes unavailable even though
2094
+ // debugNeedsLayout is false.
2095
+ }
2094
2096
2095
- try {
2096
- if (renderObject is RenderBox ) {
2097
- additionalJson['isBox' ] = true ;
2098
- additionalJson['size' ] = < String , Object > {
2099
- 'width' : renderObject.size.width.toString (),
2100
- 'height' : renderObject.size.height.toString (),
2101
- };
2102
-
2103
- final ParentData ? parentData = renderObject.parentData;
2104
- if (parentData is FlexParentData ) {
2105
- additionalJson['flexFactor' ] = parentData.flex! ;
2106
- additionalJson['flexFit' ] =
2107
- describeEnum (parentData.fit ?? FlexFit .tight);
2108
- } else if (parentData is BoxParentData ) {
2109
- final Offset offset = parentData.offset;
2110
- additionalJson['parentData' ] = < String , Object > {
2111
- 'offsetX' : offset.dx.toString (),
2112
- 'offsetY' : offset.dy.toString (),
2113
- };
2114
- }
2115
- } else if (renderObject is RenderView ) {
2116
- additionalJson['size' ] = < String , Object > {
2117
- 'width' : renderObject.size.width.toString (),
2118
- 'height' : renderObject.size.height.toString (),
2119
- };
2120
- }
2121
- } catch (e) {
2122
- // Not laid out yet.
2097
+ try {
2098
+ if (renderObject is RenderBox ) {
2099
+ additionalJson['isBox' ] = true ;
2100
+ additionalJson['size' ] = < String , Object > {
2101
+ 'width' : renderObject.size.width.toString (),
2102
+ 'height' : renderObject.size.height.toString (),
2103
+ };
2104
+
2105
+ final ParentData ? parentData = renderObject.parentData;
2106
+ if (parentData is FlexParentData ) {
2107
+ additionalJson['flexFactor' ] = parentData.flex! ;
2108
+ additionalJson['flexFit' ] =
2109
+ describeEnum (parentData.fit ?? FlexFit .tight);
2110
+ } else if (parentData is BoxParentData ) {
2111
+ final Offset offset = parentData.offset;
2112
+ additionalJson['parentData' ] = < String , Object > {
2113
+ 'offsetX' : offset.dx.toString (),
2114
+ 'offsetY' : offset.dy.toString (),
2115
+ };
2123
2116
}
2117
+ } else if (renderObject is RenderView ) {
2118
+ additionalJson['size' ] = < String , Object > {
2119
+ 'width' : renderObject.size.width.toString (),
2120
+ 'height' : renderObject.size.height.toString (),
2121
+ };
2124
2122
}
2123
+ } catch (e) {
2124
+ // Not laid out yet.
2125
2125
}
2126
2126
return additionalJson;
2127
2127
},
@@ -3633,12 +3633,12 @@ class InspectorSerializationDelegate implements DiagnosticsSerializationDelegate
3633
3633
}
3634
3634
3635
3635
@override
3636
- DiagnosticsSerializationDelegate copyWith ({int ? subtreeDepth, bool ? includeProperties}) {
3636
+ DiagnosticsSerializationDelegate copyWith ({int ? subtreeDepth, bool ? includeProperties, bool ? expandPropertyValues }) {
3637
3637
return InspectorSerializationDelegate (
3638
3638
groupName: groupName,
3639
3639
summaryTree: summaryTree,
3640
3640
maxDescendentsTruncatableNode: maxDescendentsTruncatableNode,
3641
- expandPropertyValues: expandPropertyValues,
3641
+ expandPropertyValues: expandPropertyValues ?? this .expandPropertyValues ,
3642
3642
subtreeDepth: subtreeDepth ?? this .subtreeDepth,
3643
3643
includeProperties: includeProperties ?? this .includeProperties,
3644
3644
service: service,
0 commit comments