additionalNodeProperties method Null safety

  1. @override
Map<String, Object?> additionalNodeProperties(
  1. DiagnosticsNode node
)
override

Returns a serializable map of additional information that will be included in the serialization of the given DiagnosticsNode.

This method is called for every DiagnosticsNode that's included in the serialization.

Implementation

@override
Map<String, Object?> additionalNodeProperties(DiagnosticsNode node) {
  final Map<String, Object?> result = <String, Object?>{};
  final Object? value = node.value;
  if (_interactive) {
    result['objectId'] = service.toId(node, groupName!);
    result['valueId'] = service.toId(value, groupName!);
  }
  if (summaryTree) {
    result['summaryTree'] = true;
  }
  final _Location? creationLocation = _getCreationLocation(value);
  if (creationLocation != null) {
    result['locationId'] = _toLocationId(creationLocation);
    result['creationLocation'] = creationLocation.toJsonMap();
    if (service._isLocalCreationLocation(creationLocation.file)) {
      _nodesCreatedByLocalProject.add(node);
      result['createdByLocalProject'] = true;
    }
  }
  if (addAdditionalPropertiesCallback != null) {
    result.addAll(addAdditionalPropertiesCallback!(node, this) ?? <String, Object>{});
  }
  return result;
}