truncateNodesList method

  1. @override
List<DiagnosticsNode> truncateNodesList (
  1. List<DiagnosticsNode> nodes,
  2. DiagnosticsNode owner

Truncates the given list of DiagnosticsNode that will be added to the serialization as children or properties of the owner node.

The method must return a subset of the provided nodes and may not replace any nodes. While filterProperties and filterChildren completely hide a node from the serialization, truncating a node will leave a hint in the serialization that there were additional nodes in the result that are not included in the current serialization.

By default, nodes is returned as-is.


List<DiagnosticsNode> truncateNodesList(List<DiagnosticsNode> nodes, DiagnosticsNode owner) {
  if (maxDescendentsTruncatableNode >= 0 &&
      owner?.allowTruncate == true &&
      nodes.length > maxDescendentsTruncatableNode) {
    nodes = service._truncateNodes(nodes, maxDescendentsTruncatableNode);
  return nodes;