IpAndPort.fromXML constructor

IpAndPort.fromXML(
  1. String xmlSTR
)

Implementation

factory IpAndPort.fromXML(String xmlSTR) {
  final document = XmlDocument.parse(xmlSTR);
  String hostName = document.firstChild!.attributes.firstWhere((element) => element.name.toString() == "hostName").value;
  String ip = document.firstChild!.attributes.firstWhere((element) => element.name.toString() == "ip").value;
  String port = document.firstChild!.attributes.firstWhere((element) => element.name.toString() == "port").value;
  return IpAndPort(hostName: hostName, ip: ip, port: port);
}