isEquals method

bool isEquals(
  1. XmlElement other
)

Implementation

bool isEquals(XmlElement other) {
  if (attributeName == other.attributeName) {
    final name = this.name.toString();
    if (name == other.name.toString()) {
      switch (name) {
        case 'string':
          return text.replaceAll('\r\n', '\n') ==
              other.text.replaceAll('\r\n', '\n');
        case 'plurals':
          final myChildren = children.whereType<XmlElement>();
          final otherChildren = other.children.whereType<XmlElement>();
          return !myChildren.any((e) =>
              otherChildren.firstWhereOrNull((oe) =>
                  oe.getAttribute('quantity') == e.getAttribute('quantity') &&
                  oe.text == e.text) ==
              null);
      }
    }
  }

  return false;
}