describe method
This element and those below it as a tree of descriptions, built when
called: its widget's type and key; the properties
debugFillProperties adds; the size of its render object, or of the
nearest below it, once laid out; whether it is to be rebuilt
(DiagnosticsFlag.needsBuild); and the descriptions of its children.
debugDumpTree prints it.
Implementation
DiagnosticsNode describe() {
final properties = DiagnosticPropertiesBuilder();
debugFillProperties(properties);
if (_dirty && _lifecycle == _Lifecycle.active) {
properties.flag(DiagnosticsFlag.needsBuild);
}
final children = <DiagnosticsNode>[];
visitChildren((child) => children.add(child.describe()));
final o = renderObject;
return properties.toNode(
'${widget.runtimeType}',
key: widget.key?.toString(),
size: o == null || o.constraints == null ? null : (o.width, o.height),
children: children,
);
}