toJsonMap method

  1. @mustCallSuper
Map<String, Object> toJsonMap ()

Serialize the node excluding its descendants to a JSON map.

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.


Map<String, Object> toJsonMap() {
  final Map<String, Object> data = <String, Object>{
    'name': name,
    'showSeparator': showSeparator,
    'description': toDescription(),
    'level': describeEnum(level),
    'showName': showName,
    'emptyBodyDescription': emptyBodyDescription,
    'style': describeEnum(style),
    'valueToString': value.toString(),
    'type': runtimeType.toString(),
    'hasChildren': getChildren().isNotEmpty,
  return data;