class Invoice { final int? id; final int customerId; final String date; final double total; final double tax; final double discountTotal; Invoice({ this.id, required this.customerId, required this.date, required this.total, required this.tax, required this.discountTotal, }); Map toMap() { return { 'id': id, 'customer_id': customerId, 'date': date, 'total': total, 'tax': tax, 'discount_total': discountTotal, }; } factory Invoice.fromMap(Map map) { return Invoice( id: map['id'] as int?, customerId: map['customer_id'] as int, date: map['date'] as String, total: map['total'] as double, tax: map['tax'] as double, discountTotal: map['discount_total'] as double, ); } }