ItemDefinition class
Static catalog entry for one item id — InventoryService is generic over whatever catalog a consumer app supplies; it has no concrete item list of its own.
maxStack's only invariant (> 0) is enforced by InventoryService's
own constructor (ENH-89), not here — a runtime assert on this
const-constructible class would be stripped from release builds
anyway, and a genuine if/throw here would force every const
catalog map in this repo/consumers off const.
Constructors
- ItemDefinition({required String id, int maxStack = 1, bool equippable = false, ItemRarity rarity = ItemRarity.common})
-
const
Properties
- equippable → bool
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
final
- maxStack → int
-
1means non-stackable (typical for equipment) — each unit occupies its own slot.final - rarity → ItemRarity
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited