toJson method

Map<String, dynamic> toJson({
  1. bool includeIds = false,
})

Implementation

Map<String, dynamic> toJson({bool includeIds = false}) {
  final props = <String, dynamic>{};

  for (final k in attributes.keys) {
    if (k != "\$id" || includeIds) {
      props[k] = attributes[k];
    }
  }

  final schema = doc.schema.elementsByTagName[tagName];
  if (schema!.childPropertyName != null) {
    props[schema.childPropertyName!] = getChildren().whereType<MeshElement>().map((x) => x.toJson(includeIds: includeIds)).toList();
  }
  return {tagName: props};
}