Item class

Represents an individual item in an order.

The Item class contains the name, quantity, price, and category for each item in an order.

Constructors

Item({required String name, required int quantity, required double price, required String category})
Creates a new Item object with the given name, quantity, price, and category.
Item.fromJson(Map<String, dynamic> json)
Converts a JSON object into an Item object.
factory

Properties

category String
The category to which the item belongs.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
name String
The name of the item.
getter/setter pair
price double
The price per unit of the item.
getter/setter pair
quantity int
The quantity of the item in the order.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyWith({String? name, int? quantity, double? price, String? category}) Item
Returns a copy of this Item object with the given fields replaced by new values.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts this Item object into a JSON object.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited