DevicePollingTooFastEvent.fromXML constructor

DevicePollingTooFastEvent.fromXML(
  1. String xmlSTR
)

Implementation

factory DevicePollingTooFastEvent.fromXML(String xmlSTR) {
  final document = XmlDocument.parse(xmlSTR);

  String messageName = document.rootElement.attributes.firstWhere((p0) => p0.name.toString() == "messageName").value;
  String messageID = document.rootElement.attributes.firstWhere((p0) => p0.name.toString() == "messageID").value;

  XmlElement eventElement = document.rootElement.findAllElements("devicePollingTooFastEvent").first;
  String applicationVersion = eventElement.attributes.firstWhere((p0) => p0.name.toString() == "applicationVersion", orElse: orElseEmpty).value;
  String applicationName = eventElement.attributes.firstWhere((p0) => p0.name.toString() == "applicationName", orElse: orElseEmpty).value;

  return DevicePollingTooFastEvent(
    messageName: messageName,
    messageID: int.parse(messageID),
    applicationName: applicationName,
    applicationVersion: applicationVersion,
  );
}