toJsonMap method Null safety

  1. @override
Map<String, Object?> toJsonMap(
  1. DiagnosticsSerializationDelegate delegate
)
override

Serialize the node to a JSON map according to the configuration provided in the DiagnosticsSerializationDelegate.

Subclasses should override if they have additional properties that are useful for the GUI tools that consume this JSON.

See also:

  • WidgetInspectorService, which forms the bridge between JSON returned by this method and interactive tree views in the Flutter IntelliJ plugin.

Implementation

@override
Map<String, Object?> toJsonMap(DiagnosticsSerializationDelegate delegate) {
  final Map<String, Object?> json = super.toJsonMap(delegate);
  if (value.isNotEmpty) {
    json['values'] = _formattedValues().toList();
  }
  return json;
}