BillsModel.fromJson constructor
BillsModel.fromJson(
- Map<String, dynamic> json
)
Implementation
factory BillsModel.fromJson(Map<String, dynamic> json) {
return BillsModel(
amount: _toDouble(json['amount']) ?? 0.0,
createdAt: DateTime.parse(json['created_at'].toString()),
customerId: json['customer_id'],
customerName: json['customer_name'] ?? '',
dueDate: DateTime.parse(json['due_date'].toString()),
id: json['id'],
issueDate: DateTime.parse(json['issue_date'].toString()),
referenceNumber: json['reference_number'] ?? '',
unitsConsumed: json['units_consumed'] ?? 0,
updatedAt: DateTime.parse(json['updated_at'].toString()),
);
}