parseNodes static method

List<DOMNode> parseNodes(
  1. Object? entry
)

Parses entry to a list of nodes.

Implementation

static List<DOMNode> parseNodes(Object? entry) {
  if (entry == null) {
    return <DOMNode>[];
  } else if (entry is String) {
    return _parseStringNodes(entry);
  } else if (entry is Iterable) {
    return _parseListNodes(entry);
  }

  var domNode = _parseSingleNode(entry);
  if (domNode != null) return <DOMNode>[domNode];

  if (isDOMBuilderDirectHelper(entry)) {
    try {
      dynamic f = entry;
      var tag = f();
      return parseNodes(tag);
    } catch (e, s) {
      domBuilderLog('Error calling function: $entry',
          error: e, stackTrace: s);
      return <DOMNode>[];
    }
  } else if (entry is DOMElementGenerator ||
      entry is DOMElementGeneratorFunction) {
    return [ExternalElementNode(entry)];
  } else {
    return [ExternalElementNode(entry)];
  }
}