delegateForNode method

  1. @override
DiagnosticsSerializationDelegate delegateForNode(
  1. DiagnosticsNode node
)
override

Returns the DiagnosticsSerializationDelegate to be used for adding the provided DiagnosticsNode to the serialization.

By default, this will return a copy of this delegate, which has the subtreeDepth reduced by one.

This is called for nodes that will be added to the serialization as property or child of another node. It may return the same delegate if no changes to it are necessary.

Implementation

@override
DiagnosticsSerializationDelegate delegateForNode(DiagnosticsNode node) {
  // The tricky special case here is that when in the detailsTree,
  // we keep subtreeDepth from going down to zero until we reach nodes
  // that also exist in the summary tree. This ensures that every time
  // you expand a node in the details tree, you expand the entire subtree
  // up until you reach the next nodes shared with the summary tree.
  return summaryTree || subtreeDepth > 1 || service._shouldShowInSummaryTree(node)
      ? copyWith(subtreeDepth: subtreeDepth - 1)
      : this;
}