@@ -1605,12 +1605,29 @@ abstract class DiagnosticsNode {
16051605 /// by this method and interactive tree views in the Flutter IntelliJ
16061606 /// plugin.
16071607 @mustCallSuper
1608- Map <String , Object ?> toJsonMap (DiagnosticsSerializationDelegate delegate) {
1608+ Map <String , Object ?> toJsonMap (
1609+ DiagnosticsSerializationDelegate delegate, {
1610+ bool fullDetails = true ,
1611+ }) {
16091612 Map <String , Object ?> result = < String , Object ? > {};
16101613 assert (() {
16111614 final bool hasChildren = getChildren ().isNotEmpty;
1612- result = < String , Object ? > {
1615+ final Map < String , Object ?> essentialDetails = < String , Object ? > {
16131616 'description' : toDescription (),
1617+ 'shouldIndent' : style != DiagnosticsTreeStyle .flat &&
1618+ style != DiagnosticsTreeStyle .error,
1619+ ...delegate.additionalNodeProperties (this , fullDetails: fullDetails),
1620+ if (delegate.subtreeDepth > 0 )
1621+ 'children' : toJsonList (
1622+ delegate.filterChildren (getChildren (), this ),
1623+ this ,
1624+ delegate,
1625+ fullDetails: fullDetails,
1626+ ),
1627+ };
1628+
1629+ result = ! fullDetails ? essentialDetails : < String , Object ? > {
1630+ ...essentialDetails,
16141631 'type' : runtimeType.toString (),
16151632 if (name != null )
16161633 'name' : name,
@@ -1634,18 +1651,12 @@ abstract class DiagnosticsNode {
16341651 'allowWrap' : allowWrap,
16351652 if (allowNameWrap)
16361653 'allowNameWrap' : allowNameWrap,
1637- ...delegate.additionalNodeProperties (this ),
16381654 if (delegate.includeProperties)
16391655 'properties' : toJsonList (
16401656 delegate.filterProperties (getProperties (), this ),
16411657 this ,
16421658 delegate,
1643- ),
1644- if (delegate.subtreeDepth > 0 )
1645- 'children' : toJsonList (
1646- delegate.filterChildren (getChildren (), this ),
1647- this ,
1648- delegate,
1659+ fullDetails: fullDetails,
16491660 ),
16501661 };
16511662 return true ;
@@ -1661,8 +1672,9 @@ abstract class DiagnosticsNode {
16611672 static List <Map <String , Object ?>> toJsonList (
16621673 List <DiagnosticsNode >? nodes,
16631674 DiagnosticsNode ? parent,
1664- DiagnosticsSerializationDelegate delegate,
1665- ) {
1675+ DiagnosticsSerializationDelegate delegate, {
1676+ bool fullDetails = true ,
1677+ }) {
16661678 bool truncated = false ;
16671679 if (nodes == null ) {
16681680 return const < Map <String , Object ?>> [];
@@ -1674,7 +1686,10 @@ abstract class DiagnosticsNode {
16741686 truncated = true ;
16751687 }
16761688 final List <Map <String , Object ?>> json = nodes.map <Map <String , Object ?>>((DiagnosticsNode node) {
1677- return node.toJsonMap (delegate.delegateForNode (node));
1689+ return node.toJsonMap (
1690+ delegate.delegateForNode (node),
1691+ fullDetails: fullDetails,
1692+ );
16781693 }).toList ();
16791694 if (truncated) {
16801695 json.last['truncated' ] = true ;
@@ -1857,8 +1872,17 @@ class StringProperty extends DiagnosticsProperty<String> {
18571872 final bool quoted;
18581873
18591874 @override
1860- Map <String , Object ?> toJsonMap (DiagnosticsSerializationDelegate delegate) {
1861- final Map <String , Object ?> json = super .toJsonMap (delegate);
1875+ Map <String , Object ?> toJsonMap (
1876+ DiagnosticsSerializationDelegate delegate, {
1877+ bool fullDetails = true ,
1878+ }) {
1879+ final Map <String , Object ?> json = super .toJsonMap (
1880+ delegate,
1881+ fullDetails: fullDetails,
1882+ );
1883+ if (! fullDetails) {
1884+ return json;
1885+ }
18621886 json['quoted' ] = quoted;
18631887 return json;
18641888 }
@@ -1913,8 +1937,18 @@ abstract class _NumProperty<T extends num> extends DiagnosticsProperty<T> {
19131937 }) : super .lazy ();
19141938
19151939 @override
1916- Map <String , Object ?> toJsonMap (DiagnosticsSerializationDelegate delegate) {
1917- final Map <String , Object ?> json = super .toJsonMap (delegate);
1940+ Map <String , Object ?> toJsonMap (
1941+ DiagnosticsSerializationDelegate delegate, {
1942+ bool fullDetails = true ,
1943+ }) {
1944+ final Map <String , Object ?> json = super .toJsonMap (
1945+ delegate,
1946+ fullDetails: fullDetails,
1947+ );
1948+ if (! fullDetails) {
1949+ return json;
1950+ }
1951+
19181952 if (unit != null ) {
19191953 json['unit' ] = unit;
19201954 }
@@ -2097,8 +2131,17 @@ class FlagProperty extends DiagnosticsProperty<bool> {
20972131 );
20982132
20992133 @override
2100- Map <String , Object ?> toJsonMap (DiagnosticsSerializationDelegate delegate) {
2101- final Map <String , Object ?> json = super .toJsonMap (delegate);
2134+ Map <String , Object ?> toJsonMap (
2135+ DiagnosticsSerializationDelegate delegate, {
2136+ bool fullDetails = true ,
2137+ }) {
2138+ final Map <String , Object ?> json = super .toJsonMap (
2139+ delegate,
2140+ fullDetails: fullDetails,
2141+ );
2142+ if (! fullDetails) {
2143+ return json;
2144+ }
21022145 if (ifTrue != null ) {
21032146 json['ifTrue' ] = ifTrue;
21042147 }
@@ -2219,8 +2262,17 @@ class IterableProperty<T> extends DiagnosticsProperty<Iterable<T>> {
22192262 }
22202263
22212264 @override
2222- Map <String , Object ?> toJsonMap (DiagnosticsSerializationDelegate delegate) {
2223- final Map <String , Object ?> json = super .toJsonMap (delegate);
2265+ Map <String , Object ?> toJsonMap (
2266+ DiagnosticsSerializationDelegate delegate, {
2267+ bool fullDetails = true ,
2268+ }) {
2269+ final Map <String , Object ?> json = super .toJsonMap (
2270+ delegate,
2271+ fullDetails: fullDetails,
2272+ );
2273+ if (! fullDetails) {
2274+ return json;
2275+ }
22242276 if (value != null ) {
22252277 json['values' ] = value! .map <String >((T value) => value.toString ()).toList ();
22262278 }
@@ -2357,8 +2409,17 @@ class ObjectFlagProperty<T> extends DiagnosticsProperty<T> {
23572409 }
23582410
23592411 @override
2360- Map <String , Object ?> toJsonMap (DiagnosticsSerializationDelegate delegate) {
2361- final Map <String , Object ?> json = super .toJsonMap (delegate);
2412+ Map <String , Object ?> toJsonMap (
2413+ DiagnosticsSerializationDelegate delegate, {
2414+ bool fullDetails = true ,
2415+ }) {
2416+ final Map <String , Object ?> json = super .toJsonMap (
2417+ delegate,
2418+ fullDetails: fullDetails,
2419+ );
2420+ if (! fullDetails) {
2421+ return json;
2422+ }
23622423 if (ifPresent != null ) {
23632424 json['ifPresent' ] = ifPresent;
23642425 }
@@ -2435,8 +2496,17 @@ class FlagsSummary<T> extends DiagnosticsProperty<Map<String, T?>> {
24352496 }
24362497
24372498 @override
2438- Map <String , Object ?> toJsonMap (DiagnosticsSerializationDelegate delegate) {
2439- final Map <String , Object ?> json = super .toJsonMap (delegate);
2499+ Map <String , Object ?> toJsonMap (
2500+ DiagnosticsSerializationDelegate delegate, {
2501+ bool fullDetails = true ,
2502+ }) {
2503+ final Map <String , Object ?> json = super .toJsonMap (
2504+ delegate,
2505+ fullDetails: fullDetails,
2506+ );
2507+ if (! fullDetails) {
2508+ return json;
2509+ }
24402510 if (value.isNotEmpty) {
24412511 json['values' ] = _formattedValues ().toList ();
24422512 }
@@ -2555,7 +2625,10 @@ class DiagnosticsProperty<T> extends DiagnosticsNode {
25552625 final bool allowNameWrap;
25562626
25572627 @override
2558- Map <String , Object ?> toJsonMap (DiagnosticsSerializationDelegate delegate) {
2628+ Map <String , Object ?> toJsonMap (
2629+ DiagnosticsSerializationDelegate delegate, {
2630+ bool fullDetails = true ,
2631+ }) {
25592632 final T ? v = value;
25602633 List <Map <String , Object ?>>? properties;
25612634 if (delegate.expandPropertyValues && delegate.includeProperties && v is Diagnosticable && getProperties ().isEmpty) {
@@ -2565,9 +2638,16 @@ class DiagnosticsProperty<T> extends DiagnosticsNode {
25652638 delegate.filterProperties (v.toDiagnosticsNode ().getProperties (), this ),
25662639 this ,
25672640 delegate,
2641+ fullDetails: fullDetails,
25682642 );
25692643 }
2570- final Map <String , Object ?> json = super .toJsonMap (delegate);
2644+ final Map <String , Object ?> json = super .toJsonMap (
2645+ delegate,
2646+ fullDetails: fullDetails,
2647+ );
2648+ if (! fullDetails) {
2649+ return json;
2650+ }
25712651 if (properties != null ) {
25722652 json['properties' ] = properties;
25732653 }
@@ -3503,7 +3583,10 @@ abstract class DiagnosticsSerializationDelegate {
35033583 ///
35043584 /// This method is called for every [DiagnosticsNode] that's included in
35053585 /// the serialization.
3506- Map <String , Object ?> additionalNodeProperties (DiagnosticsNode node);
3586+ Map <String , Object ?> additionalNodeProperties (
3587+ DiagnosticsNode node, {
3588+ bool fullDetails = true ,
3589+ });
35073590
35083591 /// Filters the list of [DiagnosticsNode] s that will be included as children
35093592 /// for the given `owner` node.
@@ -3595,7 +3678,10 @@ class _DefaultDiagnosticsSerializationDelegate implements DiagnosticsSerializati
35953678 });
35963679
35973680 @override
3598- Map <String , Object ?> additionalNodeProperties (DiagnosticsNode node) {
3681+ Map <String , Object ?> additionalNodeProperties (
3682+ DiagnosticsNode node, {
3683+ bool fullDetails = true ,
3684+ }) {
35993685 return const < String , Object ? > {};
36003686 }
36013687
0 commit comments