toMap method

Map<String, dynamic> toMap()

Converts the Product to a map for Firestore storage.

Returns: A Map<String, dynamic> containing the product's data.

Implementation

Map<String, dynamic> toMap() {
  return {
    'name': name,
    'description': description,
    'price': price,
    'unit': unit,
    'quantity': quantity,
    'farmerId': farmerId,
    'imageUrls': imageUrls,
    'dateAdded': dateAdded.toIso8601String(),
    'category': category,
  };
}