BlockData.fromXML constructor

BlockData.fromXML(
  1. String xmlSTR
)

Implementation

factory BlockData.fromXML(String xmlSTR) {
  final document = XmlDocument.parse(xmlSTR);
  String value = (document.firstChild?.text ?? "").replaceAll("<", "&lt;");
  String blockID = document.firstChild!
      .attributes
      .firstWhere((element) => element.name.toString() == "blockID")
      .value;
  return BlockData(blockID: blockID, value: value);
}