Product constructor

Product({
  1. String id = '',
  2. required String name,
  3. required String description,
  4. required double price,
  5. required String unit,
  6. required int quantity,
  7. required String farmerId,
  8. required List<String> imageUrls,
  9. required DateTime dateAdded,
  10. required String category,
})

Creates a Product instance with required and optional attributes.

Parameters:

  • id: The unique identifier of the product (default is empty string).
  • name: The name of the product.
  • description: A description of the product.
  • price: The price of the product.
  • unit: The unit of measurement for the product (e.g., kg, liter).
  • quantity: The available quantity of the product.
  • farmerId: The ID of the farmer who listed the product.
  • imageUrls: A list of URLs for the product's images.
  • dateAdded: The date the product was added.
  • category: The category of the product.

Implementation

Product({
  this.id = '',
  required this.name,
  required this.description,
  required this.price,
  required this.unit,
  required this.quantity,
  required this.farmerId,
  required this.imageUrls,
  required this.dateAdded,
  required this.category,
});