class TransactionItem { final String? cardType; final String? cardExpireDate; final String? cardNumber; final String? transactionType; final num? amount; final DateTime? date; TransactionItem({this.cardType, this.cardExpireDate, this.cardNumber, this.transactionType, this.amount, this.date}); static TransactionItem fromJson(Map json) { return TransactionItem( cardType: json['cardType'], cardExpireDate: json['cardExpireDate'], cardNumber: json['cardNumber'], transactionType: json['transactionType'], amount: json['amount'], date: json['date'] != null ? DateTime.parse(json['date']) : null, ); } Map toJson() => { 'cardType': cardType, 'cardExpireDate': cardExpireDate, 'cardNumber': cardNumber, 'transactionType': transactionType, 'amount': amount, 'date' : date !=null ? date.toString() : null, }; }