*[<Null safety>](https://dart.dev/null-safety)*
void inspectFromDiagnostic (dynamic diagnostics, Node? parent)
@visibleForTesting static void inspectFromDiagnostic(DiagnosticsNode diagnostics, Node? parent) { // Finds the name of the widget and assigns it to the name of the node. String name = ''; for (DiagnosticsNode diagNode in diagnostics.getProperties()) { // Used to obtain the name of the widget by checking which // property is titled "widget" if (diagNode.name == 'widget') { name = diagNode.value.toString(); break; } } // If the name of the child does not exist log it and skip that node if (name == '') { print('Name of node cannot be found'); return; } // Adds a hashcode to the name of the node so that the widgets with the same // names do not get their properties merged. var childNode = parent!.child('${name}_${diagnostics.hashCode}'); // For each property, add the property to the node. for (DiagnosticsNode diagNode in diagnostics.getProperties()) { // If the property isn't null, then get the name of the property // and assign its value. The value of the property can be null // but the property itself cannot be null. if (diagNode.name != null) { childNode! .stringProperty(diagNode.name!)! .setValue(diagNode.toDescription()); } } for (DiagnosticsNode diagNode in diagnostics.getChildren()) { inspectFromDiagnostic(diagNode, childNode); } }