getElement method Null safety

  1. @override
XmlElement? getElement(
  1. String name,
  2. {String? namespace}
)

Return the first child element with the given name, or null.

Implementation

@override
XmlElement? getElement(String name, {String? namespace}) {
  final tester = createNameMatcher(name, namespace);
  for (final node in children) {
    if (node is XmlElement && tester(node)) {
      return node;
    }
  }
  return null;
}