removeItem method

void removeItem(
  1. String id
)

API to remove item.

Parameters: id - ID of item to remove.

Exceptions: Throws an ArgumentError if the ID is empty. Throws an ArgumentError if the ID is invalid.

Implementation

void removeItem(String id){
  int index;
  if (id.isEmpty) {
    throw ArgumentError("removeItem : You must set itemId.");
  }
  else if ((index = _getItemIndex(id)) < 0) {
    throw ArgumentError("removeItem : there is no id.");
  }
  items?.removeAt(index);
}