cell method
returns the DataObject
at position of cellIndex
Implementation
Data cell(CellIndex cellIndex) {
_checkMaxCol(cellIndex.columnIndex);
_checkMaxRow(cellIndex.rowIndex);
if (cellIndex._columnIndex < 0 || cellIndex._rowIndex < 0) {
_damagedExcel(
text:
'${cellIndex._columnIndex < 0 ? "Column" : "Row"} Index: ${cellIndex._columnIndex < 0 ? cellIndex._columnIndex : cellIndex._rowIndex} Negative index does not exist.');
}
/// increasing the rowCount
if (_maxRows < (cellIndex._rowIndex + 1)) {
_maxRows = cellIndex._rowIndex + 1;
}
/// increasing the colCount
if (_maxCols < (cellIndex._columnIndex + 1)) {
_maxCols = cellIndex._columnIndex + 1;
}
/// checking if the map has been already initialized or not?
/// if the user has called this class by its own
/* if (_sheetData == null) {
_sheetData = Map<int, Map<int, Data>>();
} */
/// if the sheetData contains the row then start putting the column
if (_sheetData[cellIndex._rowIndex] != null) {
if (_sheetData[cellIndex._rowIndex]![cellIndex._columnIndex] == null) {
_sheetData[cellIndex._rowIndex]![cellIndex._columnIndex] =
Data.newData(this, cellIndex.rowIndex, cellIndex.columnIndex);
}
} else {
/// else put the column with map showing.
_sheetData[cellIndex._rowIndex] = {
cellIndex._columnIndex:
Data.newData(this, cellIndex.rowIndex, cellIndex.columnIndex)
};
}
return _sheetData[cellIndex._rowIndex]![cellIndex._columnIndex]!;
}