Product constructor

Product({
  1. String? id,
  2. required String name,
  3. required String description,
  4. required double price,
  5. required ProductType type,
  6. required ListingType listingType,
  7. required String sellerId,
  8. String? location,
  9. DateTime? createdAt,
  10. List<String>? images,
  11. bool isAvailable = true,
})

Implementation

Product({
  String? id,
  required this.name,
  required this.description,
  required this.price,
  required this.type,
  required this.listingType,
  required this.sellerId,
  this.location,
  DateTime? createdAt,
  this.images,
  this.isAvailable = true,
})  : id = id ?? const Uuid().v4(),
      createdAt = createdAt ?? DateTime.now();