debugDescribeChildren method

  1. @override
List<DiagnosticsNode> debugDescribeChildren ()
override

Returns a list of DiagnosticsNode objects describing this node's children.

Children that are offstage should be added with style set to DiagnosticsTreeStyle.offstage to indicate that they are offstage.

The list must not contain any null entries. If there are explicit null children to report, consider new DiagnosticsNode.message or DiagnosticsProperty<Object> as possible DiagnosticsNode objects to provide.

Used by toStringDeep, toDiagnosticsNode and toStringShallow.

See also:

Implementation

@override
List<DiagnosticsNode> debugDescribeChildren() {
  final List<DiagnosticsNode> children = <DiagnosticsNode>[];
  if (firstChild != null) {
    RenderBox child = firstChild;
    while (true) {
      final SliverMultiBoxAdaptorParentData childParentData = child.parentData;
      children.add(child.toDiagnosticsNode(name: 'child with index ${childParentData.index}'));
      if (child == lastChild)
        break;
      child = childParentData.nextSibling;
    }
  }
  if (_keepAliveBucket.isNotEmpty) {
    final List<int> indices = _keepAliveBucket.keys.toList()..sort();
    for (int index in indices) {
      children.add(_keepAliveBucket[index].toDiagnosticsNode(
        name: 'child with index $index (kept alive but not laid out)',
        style: DiagnosticsTreeStyle.offstage,
      ));
    }
  }
  return children;
}