QuotesModel.fromJson constructor

QuotesModel.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory QuotesModel.fromJson(Map<String, dynamic> json) {
  return QuotesModel(
    billId: json['bill_id'] ?? '',
    calculations: json['calculations'] != null ? (json['calculations'] is String ? jsonDecode(json['calculations']) : json['calculations']) : {},
    createdAt: DateTime.parse(json['created_at'].toString()),
    customerEmail: json['customer_email'] ?? '',
    id: json['id'],
    systemSize: _toDouble(json['system_size']) ?? 0.0,
    totalCost: _toDouble(json['total_cost']) ?? 0.0,
    updatedAt: DateTime.parse(json['updated_at'].toString()),
  );
}