Item.fromJson constructor

Item.fromJson(
  1. Object? json
)

Implementation

factory Item.fromJson(Object? json) {
  final map = (json as Map).cast<String, Object?>();
  return Item(
    amountDiscount: (map['amount_discount'] as num).toInt(),
    amountSubtotal: (map['amount_subtotal'] as num).toInt(),
    amountTax: (map['amount_tax'] as num).toInt(),
    amountTotal: (map['amount_total'] as num).toInt(),
    currency: (map['currency'] as String),
    description: (map['description'] as String),
    discounts: map['discounts'] == null
        ? null
        : (map['discounts'] as List<Object?>)
            .map((el) => LineItemsDiscountAmount.fromJson(el))
            .toList(),
    id: (map['id'] as String),
    price:
        map['price'] == null ? null : InvoiceitemPrice.fromJson(map['price']),
    quantity:
        map['quantity'] == null ? null : (map['quantity'] as num).toInt(),
    taxes: map['taxes'] == null
        ? null
        : (map['taxes'] as List<Object?>)
            .map((el) => LineItemsTaxAmount.fromJson(el))
            .toList(),
  );
}