createTableEntry function

TABLENode? createTableEntry(
  1. Object? entry, {
  2. bool? header,
  3. bool? footer,
})

Implementation

TABLENode? createTableEntry(Object? entry, {bool? header, bool? footer}) {
  if (entry == null) return null;
  header ??= false;
  footer ??= false;

  if (entry is THEADElement) {
    return entry;
  } else if (entry is CAPTIONElement) {
    return entry;
  } else if (entry is TBODYElement) {
    return entry;
  } else if (entry is TFOOTElement) {
    return entry;
  } else if (_domHTML.isHtmlElementNode(entry)) {
    return _domHTML.toDOMElement(entry) as TABLENode?;
  } else if (_domHTML.isHtmlTextNode(entry)) {
    var domNode = _domHTML.toTextNode(entry);
    return domNode != null ? TDElement(content: domNode.text) : null;
  } else {
    if (header) {
      return $thead(rows: entry);
    } else if (footer) {
      return $tfoot(rows: entry);
    } else {
      return $tbody(rows: entry);
    }
  }
}