in lib/src/hierarchy_view.dart [104:195]
void _addMetadata(Map<String, dynamic> node, LogicalRow row,
HtmlElement tbody, int level, Function fetch) {
// A helper method for generating a row-generating function.
GenerateRowFunction renderSelfWith(Function renderFn,
{int sortPriority: 0}) {
void render(TreeTableRow row, LogicalRow lRow) {
row.data = renderFn();
}
return () {
LogicalRow lrow =
new LogicalRow(node, render, row.parentElement, level);
lrow.sortable = false;
lrow.nonSortablePriority = sortPriority;
return lrow;
};
}
switch (node['kind']) {
case 'function':
case 'closure':
case 'constructor':
case 'method':
// Side Effects
row.addChild(renderSelfWith(() => [
_cell('side effects'),
_cell(node['sideEffects'], colspan: '5')
]));
// Modifiers
if (node.containsKey('modifiers')) {
(node['modifiers'] as Map<String, bool>).forEach((k, v) {
if (v) {
row.addChild(renderSelfWith(
() => [_cell('modifier'), _cell(k, colspan: '5')]));
}
});
}
// Return type
row.addChild(renderSelfWith(() => [
_cell('return type'),
_typeCell(node['returnType'], node['inferredReturnType'],
colspan: '5')
]));
// Parameters
if (node.containsKey('parameters')) {
for (Map<String, dynamic> param in node['parameters']) {
String declaredType = param['declaredType'] == null
? "unavailable"
: param['declaredType'];
row.addChild(renderSelfWith(() => [
_cell('parameter'),
_cell(param['name']),
_typeCell(declaredType, param['type'], colspan: '4')
]));
}
}
// Code
if (node['code'] != null && node['code'].length != 0) {
row.addChild(renderSelfWith(() => [
_cell('code'),
_cell(node['code'], colspan: '5', pre: true)
], sortPriority: -1));
}
break;
case 'field':
// Code
if (node['code'] != null && node['code'].length != 0) {
row.addChild(renderSelfWith(() => [
_cell('code'),
_cell(node['code'], colspan: '5', pre: true)
], sortPriority: -1));
}
// Types
if (node['inferredType'] != null && node['type'] != null) {
row.addChild(renderSelfWith(() => [
_cell('type'),
_typeCell(node['type'], node['inferredType'], colspan: '5')
]));
}
break;
case 'class':
case 'library':
// Show how much of the size we can't account for.
row.addChild(renderSelfWith(() => [
_cell('scaffolding'),
_cell('(unaccounted for)'),
_cell(node['size'] - _computeSize(node, fetch, force: true),
align: 'right')
]));
break;
}
}