findImg function

Element? findImg(
  1. Element tar
)

Implementation

Element? findImg(Element tar) {
  if (tar.children != null) {
    for (var ele in tar.children) {
      if (ele.localName == 'img' && ele.attributes['src']!.startsWith('http')) {
        return ele;
      } else {
        if (ele.children != null) {
          final rs = findImg(ele);
          if (rs != null) {
            return rs;
          }
        }
      }
    }
  }
}