toJson method

Map<String, dynamic> toJson()

Converts the item details to a JSON representation.

Implementation

Map<String, dynamic> toJson() => {
      'id': id,
      'price': price,
      'quantity': quantity,
      'name': name,
      'imageUrl': imageUrl,
    }..removeWhere((key, value) => value == null);