toJson method
Converts the BaseDTO to a JSON object.
This method can be used when making HTTP requests to convert the DTO to a format that can be sent in the request.
Implementation
@override
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = super.toJson();
if (campaign != null) {
data['campaign'] = campaign!.toJson();
}
if (currency != null) {
data['currency'] = currency!.toJson();
}
if (customer != null) {
data['customer'] = customer!.toJson();
}
if (email != null) {
data['email'] = email!.toJson();
}
if (order != null) {
data['order'] = order!.toJson();
}
if (product != null) {
data['product'] = product!.toJson();
}
if (sms != null) {
data['sms'] = sms!.toJson();
}
data['analytic'] = analytic;
return data;
}