fromJson static method

InvoiceModel? fromJson(
  1. dynamic value
)

Returns a new InvoiceModel instance and imports its values from value if it's a Map, null otherwise.

Implementation

// ignore: prefer_constructors_over_static_methods
static InvoiceModel? fromJson(dynamic value) {
  if (value is Map) {
    final json = value.cast<String, dynamic>();
    return InvoiceModel(
      id: mapValueOfType<int>(json, r'id'),
      customerId: mapValueOfType<int>(json, r'customerId'),
      employeeId: mapValueOfType<int>(json, r'employeeId'),
      date: mapDateTime(json, r'date', ''),
      description: mapValueOfType<String>(json, r'description'),
      discount: mapValueOfType<double>(json, r'discount'),
      value: mapValueOfType<double>(json, r'value'),
    );
  }
  return null;
}