setChildren method

void setChildren(
  1. List<List<RenderBox>>? cells
)

Replaces the children of this table with the given cells.

Implementation

void setChildren(List<List<RenderBox>>? cells) {
  // TODO(ianh): Make this smarter, like setFlatChildren
  if (cells == null) {
    setFlatChildren(0, const <RenderBox?>[]);
    return;
  }
  for (final RenderBox? oldChild in _children) {
    if (oldChild != null) {
      dropChild(oldChild);
    }
  }
  _children.clear();
  _columns = cells.isNotEmpty ? cells.first.length : 0;
  _rows = 0;
  cells.forEach(addRow);
  assert(_children.length == rows * columns);
}