save before flutter upgrade
This commit is contained in:
25
lib/models/customers/invoice.dart
Normal file
25
lib/models/customers/invoice.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class Invoice {
|
||||
Invoice({
|
||||
required this.invoiceId,
|
||||
required this.date,
|
||||
required this.code,
|
||||
});
|
||||
|
||||
int invoiceId;
|
||||
DateTime date;
|
||||
String code;
|
||||
|
||||
factory Invoice.fromJson(String str) => Invoice.fromMap(json.decode(str));
|
||||
|
||||
factory Invoice.fromMap(Map<String, dynamic> json) {
|
||||
Invoice invoice = Invoice(
|
||||
invoiceId: json['invoice_id'],
|
||||
date: DateTime.parse(json["created_at"]),
|
||||
code: json['invoice'],
|
||||
);
|
||||
|
||||
return invoice;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user