updateItem method

void updateItem(
  1. String id,
  2. String text
)

API to update item text.

Parameters: id ID to update. text Item String to update.

Exceptions: Throws an ArgumentError if the ID is empty. Throws an ArgumentError if there is no item associated with the ID.

Implementation

void updateItem(String id, String text) {
  if (id.isEmpty) {
    throw  ArgumentError("updateItem : You must set ID.");
  } else if (text.isEmpty) {
    throw  ArgumentError("addItem : You must set value.");
  }
  int foundIndex = _getIndex(0, id);
  if (foundIndex > -1) {
    SheetItem sheetItem = SheetItem(id: id,sValue: text);
    items![foundIndex] = sheetItem;
    return;
  }
  throw  ArgumentError("updateItem : There is no item associated with the ID.");
}