toXml method

XMLNode toXml()

Implementation

XMLNode toXml() {
  assert(
    id != null || software != null || device != null,
    'A completely empty user agent makes no sense',
  );
  return XMLNode(
    tag: 'user-agent',
    attributes: {
      if (id != null) 'id': id,
    },
    children: [
      if (software != null)
        XMLNode(
          tag: 'software',
          text: software,
        ),
      if (device != null)
        XMLNode(
          tag: 'device',
          text: device,
        ),
    ],
  );
}