toJson method

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

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['highlighted'] = highlighted;
  if (users != null) {
    data['users'] = users!.map((v) => v.toJson()).toList();
  }
  if (paymentMethod != null) {
    data['paymentMethod'] = paymentMethod!.toJson();
  }
  if (shipmentMethods != null) {
    data['shipmentMethods'] =
        shipmentMethods!.map((v) => v.toJson()).toList();
  }
  if (info != null) {
    data['info'] = info!.toJson();
  }
  if (module != null) {
    data['module'] = module!.toJson();
  }
  data['permission'] = permission;
  if (setting != null) {
    data['setting'] = setting!.toJson();
  }
  data['type'] = type;
  return data;
}