toJson method
Converts this Item object into a JSON object.
The resulting JSON will follow the same format as required by Item.fromJson.
Implementation
Map<String, dynamic> toJson() {
return {
'name': name,
'quantity': quantity,
'price': price,
'category': category.toLowerCase(),
};
}