addItem method

dynamic addItem({
  1. required Item item,
  2. int quantity = 1,
})

Add a new Item to the inventory or update the existing Item inventory by increasing the amount by quantity

Implementation

addItem({required Item item, int quantity = 1}) {
  items.update(item, (value) => value + quantity, ifAbsent: () => quantity);
}