toPutJson method

  1. @override
Map<String, dynamic>? toPutJson()
override

Converts the body data model to a JSON object for a PUT request.

This method should be implemented by subclasses to convert their specific data to a JSON object. It should only include properties that need to be sent in a PUT request.

Implementation

@override
Map<String, dynamic>? toPutJson() {
  Map<String, dynamic> data = <String, dynamic>{};
  data["title"] = title;
  data["description"] = description;
  data["photoUrl"] = photoUrl;
  data["userId"] = userId;
  if (products != null) {
    data["products"] = products!.map((e) => e).toList();
  }

  if (categories != null) {
    data["categories"] = categories!.map((e) => e).toList();
  }
  if (campaigns != null) {
    data["campaigns"] = campaigns!.map((e) => e).toList();
  }
  data["storeId"] = storeId;
  return data;
}