import 'dart:convert'; class SummaryResponseModel { String? status; SummaryModel? data; SummaryResponseModel({ this.status, this.data, }); factory SummaryResponseModel.fromJson(String str) => SummaryResponseModel.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory SummaryResponseModel.fromMap(Map json) => SummaryResponseModel( status: json["status"], data: json["data"] == null ? null : SummaryModel.fromMap(json["data"]), ); Map toMap() => { "status": status, "data": data?.toMap(), }; } class SummaryModel { String? totalRevenue; String? totalDiscount; String? totalTax; String? totalSubtotal; String? totalServiceCharge; int? total; SummaryModel({ this.totalRevenue, this.totalDiscount, this.totalTax, this.totalSubtotal, this.totalServiceCharge, this.total, }); factory SummaryModel.fromJson(String str) => SummaryModel.fromMap(json.decode(str)); String toJson() => json.encode(toMap()); factory SummaryModel.fromMap(Map json) => SummaryModel( totalRevenue: json["total_revenue"] is int ? json["total_revenue"].toString() : json["total_revenue"], totalDiscount: json["total_discount"] is int ? json["total_discount"].toString() : json["total_discount"], totalTax: json["total_tax"] is int ? json["total_tax"].toString() : json["total_tax"], totalSubtotal: json["total_subtotal"] is int ? json["total_subtotal"].toString() : json["total_subtotal"], totalServiceCharge: json["total_service_charge"] is int ? json["total_service_charge"].toString() : json["total_service_charge"], total: json["total"], ); Map toMap() => { "total_revenue": totalRevenue, "total_discount": totalDiscount, "total_tax": totalTax, "total_subtotal": totalSubtotal, "total_service_charge": totalServiceCharge, "total": total, }; }