Stanza.fromXMLNode constructor

Stanza.fromXMLNode(
  1. XMLNode node
)

Implementation

factory Stanza.fromXMLNode(XMLNode node) {
  return Stanza(
    to: node.attributes['to'] as String?,
    from: node.attributes['from'] as String?,
    id: node.attributes['id'] as String?,
    tag: node.tag,
    type: node.attributes['type'] as String?,
    children: node.children,
    // TODO(Unknown): Remove to, from, id, and type
    // TODO(Unknown): Not sure if this is the correct way to approach this
    attributes:
        node.attributes.map<String, String>((String key, dynamic value) {
      return MapEntry(key, value.toString());
    }),
  );
}