cell method
returns the DataObject at position of cellIndex
Implementation
Data cell(CellIndex cellIndex) {
_checkMaxColumn(cellIndex.columnIndex);
_checkMaxRow(cellIndex.rowIndex);
if (cellIndex.columnIndex < 0 || cellIndex.rowIndex < 0) {
final negative = cellIndex.columnIndex < 0;
throw ArgumentError.value(
negative ? cellIndex.columnIndex : cellIndex.rowIndex,
negative ? 'columnIndex' : 'rowIndex',
'must not be negative',
);
}
/// increasing the row count
if (_maxRows < (cellIndex.rowIndex + 1)) {
_maxRows = cellIndex.rowIndex + 1;
}
/// increasing the column count
if (_maxColumns < (cellIndex.columnIndex + 1)) {
_maxColumns = cellIndex.columnIndex + 1;
}
var row = _sheetData[cellIndex.rowIndex];
if (row == null) {
_sheetData[cellIndex.rowIndex] = row = {};
}
return row[cellIndex.columnIndex] ??= Data.newData(
this as Sheet,
cellIndex.rowIndex,
cellIndex.columnIndex,
);
}