removeItem method

void removeItem(
  1. String id
)

API to remove item.

Parameters: id ID to be removed.

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

Implementation

void removeItem(String id) {
  int index;
  if (id.isEmpty) {
    throw ArgumentError("removeItem : You must set id.");
  } else if ((index = _getIndex(0, id)) < 0) {
    throw ArgumentError("removeItem : There is no item associated with the ID.");
  }
  items?.removeAt(index);
}