$html<T extends DOMNode> function

List<DOMNode> $html<T extends DOMNode>(
  1. Object? html
)

Returns a list of nodes from html.

Implementation

List<DOMNode> $html<T extends DOMNode>(Object? html) {
  if (html == null) return <DOMNode>[];
  if (html is String) {
    return DOMNode.parseStringNodes(html) ?? <DOMNode>[];
  } else if (html is Iterable) {
    return DOMNode.parseStringNodes(html.join('')) ?? <DOMNode>[];
  }

  throw ArgumentError("Can't parse type: ${html.runtimeType}");
}