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
Map<String, dynamic> toJson() {
Map<String, dynamic> data = <String, dynamic>{};
if (page != null) data["page"] = page;
if (amount != null) data["amount"] = amount;
if (status != null) data["status"] = status.toString().split('.').last;
return data;
}