InvoiceLineItemUpdateOptions.fromJson constructor
InvoiceLineItemUpdateOptions.fromJson(
- Object? json
Implementation
factory InvoiceLineItemUpdateOptions.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return InvoiceLineItemUpdateOptions(
amount: map['amount'] == null ? null : (map['amount'] as num).toInt(),
description:
map['description'] == null ? null : (map['description'] as String),
discountable:
map['discountable'] == null ? null : (map['discountable'] as bool),
discounts: map['discounts'] == null
? null
: (map['discounts'] as List<Object?>)
.map((el) => InvoiceItemDiscountsItem.fromJson(el))
.toList(),
expand: map['expand'] == null
? null
: (map['expand'] as List<Object?>)
.map((el) => (el as String))
.toList(),
metadata: map['metadata'] == null
? null
: (map['metadata'] as Map).cast<String, Object?>().map((
key,
value,
) =>
MapEntry(
key,
(value as String),
)),
period: map['period'] == null
? null
: InvoiceLineItemPeriod.fromJson(map['period']),
price: map['price'] == null ? null : (map['price'] as String),
priceData: map['price_data'] == null
? null
: InvoiceLineItemPriceData.fromJson(map['price_data']),
quantity:
map['quantity'] == null ? null : (map['quantity'] as num).toInt(),
taxAmounts: map['tax_amounts'] == null
? null
: (map['tax_amounts'] as List<Object?>)
.map((el) => InvoiceLineItemTaxAmountsItem.fromJson(el))
.toList(),
taxRates: map['tax_rates'] == null
? null
: (map['tax_rates'] as List<Object?>)
.map((el) => (el as String))
.toList(),
);
}