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();
data['title'] = title;
data['status'] = status;
data['code'] = code;
data['delegatedTo'] = delegatedTo;
if (items != null) {
data['items'] = items!.map((v) => v.toJson()).toList();
}
if (assignedUsers != null) {
data['assignedUsers'] = assignedUsers!.map((v) => v.toJson()).toList();
}
if (createdUser != null) {
data['createdUser'] = createdUser!.toJson();
}
if (category != null) {
data['category'] = category!.toJson();
}
if (store != null) {
data['store'] = store!.toJson();
}
return data;
}