clearRow method

bool clearRow(
  1. int rowIndex
)

returns true if the contents are successfully cleared else false.

If the row is having any spanned-cells then it will not be cleared and hence returns false.

Implementation

bool clearRow(int rowIndex) {
  if (rowIndex < 0) {
    return false;
  }

  bool isNotInside = true;

  if (_sheetData[rowIndex] != null && _sheetData[rowIndex]!.isNotEmpty) {
    for (int i = 0; i < _spanList.length; i++) {
      _Span? spanObj = _spanList[i];
      if (spanObj == null) {
        continue;
      }
      if (rowIndex >= spanObj.rowSpanStart &&
          rowIndex <= spanObj.rowSpanEnd) {
        isNotInside = false;
        break;
      }
    }

    if (isNotInside) {
      _sheetData[rowIndex]!.keys.toList().forEach((key) {
        _sheetData[rowIndex]![key] = Data.newData(this, rowIndex, key);
      });
    }
  }
  return isNotInside;
}