toMap method

Map<String, dynamic> toMap()

Implementation

Map<String, dynamic> toMap() {
  Map<String, dynamic> map = {"type": type};

  if (tag != null) map["tag"] = tag;
  if (text != null) map["text"] = text;

  if (attributes != null) {
    map["attributes"] =
        attributes?.map((attribute) => attribute.toMap()).toList();
  }

  if (children != null) {
    map["children"] = children?.map((child) => child.toMap()).toList();
  }
  return map;
}