toJson method
Converts the QueryModel to a JSON object.
This method can be used when making HTTP requests to convert the query model to a format that can be sent in the request.
It only includes the page and amount properties if they are not null
.
Implementation
@override
Map<String, dynamic> toJson() {
Map<String, dynamic> data = super.toJson();
if (storeId != null) data["storeId"] = storeId;
if (type != null) data["type"] = type.toString().split('.').last;
if (dateType != null) {
data["dateType"] = dateType.toString().split('.').last;
}
if (currencyType != null) {
data["currencyType"] = currencyType.toString().split('.').last;
}
if (withPrices != null) data["withPrices"] = withPrices;
if (isTest != null) data["isTest"] = isTest;
if (startDate != null) data["startDate"] = startDate;
if (endDate != null) data["endDate"] = endDate;
return data;
}