findElements function Null safety

Iterable<XmlElement>? findElements(
  1. XmlNode? node,
  2. String name,
  3. {bool recursive = false,
  4. String? namespace}
)

Implementation

Iterable<XmlElement>? findElements(
  XmlNode? node,
  String name, {
  bool recursive = false,
  String? namespace,
}) {
  try {
    if (recursive) {
      return node?.findAllElements(name, namespace: namespace);
    } else {
      return node?.findElements(name, namespace: namespace);
    }
  } on StateError {
    return null;
  }
}