updateTitle method

void updateTitle(
  1. String id,
  2. String title
)

API to update item title.

Parameters:
id - Unique ID of item to update.
title - Title to be set.

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

Implementation

void updateTitle(String id, String title){
  if (id.isEmpty) {
    throw ArgumentError("You must set itemId.");
  }
  int foundIndex = items!.indexWhere((items) => items.id == id);

  if (foundIndex > -1) {
    SheetItem item = SheetItem(id: id, title: title, dValue: items!.elementAt(foundIndex).dValue, sValue: items!.elementAt(foundIndex).sValue, sheetItemType:items![foundIndex].getSheetItemType());
    items?.insert(foundIndex,item);
    return;
  }
  throw ArgumentError("updateTitle : there are no items associated with the id.");
}