HGrid constructor

HGrid(
  1. HDict _meta,
  2. List<HCol> cols,
  3. List<List<HVal?>> rowList
)

Implementation

HGrid(this._meta, this.cols, List<List<HVal?>> rowList)
    : _rows = <HRow>[],
      _colsByName = <String, HCol>{}
{
  for (int i = 0; i < rowList.length; ++i) {
    List<HVal?> cells = rowList[i];
    if (cols.length != cells.length) {
      throw ArgumentError('Row cells size != cols size');
    }

    _rows.add(HRow(this, cells));
  }

  for (int i = 0; i < cols.length; ++i) {
    HCol col = cols[i];
    String colName = col.name;
    if (_colsByName.containsKey(colName)) {
      throw ArgumentError('Duplicate col name: $colName');
    }

    _colsByName[colName] = col;
  }
}