class VoucherModel { int? status; bool? error; List? data; VoucherModel({this.status, this.error, this.data}); VoucherModel.fromJson(Map json) { status = json['status'] is String ? int.parse(json['status']) : json['status']; error = json['error']; if (json['data'] != null) { data = []; json['data'].forEach((v) { data!.add(new DataVoucher.fromJson(v)); }); } } Map toJson() { final Map data = new Map(); data['status'] = this.status; data['error'] = this.error; if (this.data != null) { data['data'] = this.data!.map((v) => v.toJson()).toList(); } return data; } } class DataVoucher { String? idCourse; String? typeCoupon; String? value; String? discountFlag; String? courseName; String? instructor; String? fotoProfile; String? thubmnail; String? originalPrice; dynamic discountPrice; dynamic finalPrice; DataVoucher( {this.idCourse, this.typeCoupon, this.value, this.discountFlag, this.courseName, this.instructor, this.fotoProfile, this.thubmnail, this.originalPrice, this.discountPrice, this.finalPrice}); DataVoucher.fromJson(Map json) { idCourse = json['id_course']; typeCoupon = json['type_coupon']; value = json['value']; discountFlag = json['discount_flag']; courseName = json['course_name']; instructor = json['instructor']; fotoProfile = json['foto_profile']; thubmnail = json['thubmnail']; originalPrice = json['original_price']; discountPrice = json['discount_price'] is String ? int.parse(json['discount_price']) : json['discount_price']; finalPrice = json['final_price'] is String ? int.parse(json['final_price']) : json['final_price']; } Map toJson() { final Map data = new Map(); data['id_course'] = this.idCourse; data['type_coupon'] = this.typeCoupon; data['value'] = this.value; data['discount_flag'] = this.discountFlag; data['course_name'] = this.courseName; data['instructor'] = this.instructor; data['foto_profile'] = this.fotoProfile; data['thubmnail'] = this.thubmnail; data['original_price'] = this.originalPrice; data['discount_price'] = this.discountPrice; data['final_price'] = this.finalPrice; return data; } }