// // To parse this JSON data, do // // // // final couponResponse = couponResponseFromJson(jsonString); // import 'dart:convert'; // CouponResponse couponResponseFromJson(String str) => CouponResponse.fromJson(json.decode(str)); // String couponResponseToJson(CouponResponse data) => json.encode(data.toJson()); // class CouponResponse { // bool? isValid; // String? originalPrice; // int? discountAmount; // int? finalPrice; // String? message; // CouponDetails? couponDetails; // CouponResponse({ // this.isValid, // this.originalPrice, // this.discountAmount, // this.finalPrice, // this.message, // this.couponDetails, // }); // factory CouponResponse.fromJson(Map json) => CouponResponse( // isValid: json["isValid"], // originalPrice: json["originalPrice"], // discountAmount: json["discountAmount"], // finalPrice: json["finalPrice"], // message: json["message"], // couponDetails: CouponDetails.fromJson(json["couponDetails"]), // ); // Map toJson() => { // "isValid": isValid, // "originalPrice": originalPrice, // "discountAmount": discountAmount, // "finalPrice": finalPrice, // "message": message, // "couponDetails": couponDetails!.toJson(), // }; // } // class CouponDetails { // String? code; // String? type; // String? discountValue; // CouponDetails({ // this.code, // this.type, // this.discountValue, // }); // factory CouponDetails.fromJson(Map json) => CouponDetails( // code: json["code"], // type: json["type"], // discountValue: json["discountValue"], // ); // Map toJson() => { // "code": code, // "type": type, // "discountValue": discountValue, // }; // } // To parse this JSON data, do // // final couponResponse = couponResponseFromJson(jsonString); // To parse this JSON data, do // // final couponResponse = couponResponseFromJson(jsonString); import 'dart:convert'; CouponResponse couponResponseFromJson(String str) => CouponResponse.fromJson(json.decode(str)); String couponResponseToJson(CouponResponse data) => json.encode(data.toJson()); class CouponResponse { bool? isValid; double? originalPrice; double? eligibleSubtotal; dynamic? discountAmount; double? finalPrice; String? message; CouponDetails? couponDetails; CouponResponse({ this.isValid, this.originalPrice, this.eligibleSubtotal, this.discountAmount, this.finalPrice, this.message, this.couponDetails, }); factory CouponResponse.fromJson(Map json) => CouponResponse( isValid: json["isValid"], originalPrice: json["originalPrice"].toDouble(), eligibleSubtotal: json["eligibleSubtotal"].toDouble(), discountAmount: json["discountAmount"], finalPrice: json["finalPrice"].toDouble(), message: json["message"], couponDetails: CouponDetails.fromJson(json["couponDetails"]), ); Map toJson() => { "isValid": isValid, "originalPrice": originalPrice, "eligibleSubtotal": eligibleSubtotal, "discountAmount": discountAmount, "finalPrice": finalPrice, "message": message, "couponDetails": couponDetails!.toJson(), }; } class CouponDetails { String? code; String? type; String? discountValue; CouponDetails({ this.code, this.type, this.discountValue, }); factory CouponDetails.fromJson(Map json) => CouponDetails( code: json["code"], type: json["type"], discountValue: json["discountValue"], ); Map toJson() => { "code": code, "type": type, "discountValue": discountValue, }; }