toJson method

Map<String, Object> toJson()

Implementation

Map<String, Object> toJson() {
  var map = <String, Object>{
    'type': type,
  };
  if (children.isNotEmpty) {
    map['children'] =
        children.map((node) => node.toJson()).toList(growable: false);
  }
  if (attributes.isNotEmpty) {
    map['attributes'] = attributes;
  }
  return map;
}