toJsonMap method

  1. @override
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> json = super.toJsonMap();
  if (defaultValue != kNoDefaultValue)
    json['defaultValue'] = defaultValue.toString();
  if (ifEmpty != null)
    json['ifEmpty'] = ifEmpty;
  if (ifNull != null)
    json['ifNull'] = ifNull;
  if (tooltip != null)
    json['tooltip'] = tooltip;
  json['missingIfNull'] = missingIfNull;
  if (exception != null)
    json['exception'] = exception.toString();
  json['propertyType'] = propertyType.toString();
  json['valueToString'] = valueToString();
  json['defaultLevel'] = describeEnum(_defaultLevel);
  if (T is Diagnosticable)
    json['isDiagnosticableValue'] = true;
  return json;