SummaryLineItem.fromJson constructor
Construct a SummaryLineItem from a JSON-like map produced by toJson. This is used when merchantArgs are passed through platform channels or stored as normalized maps.
Implementation
factory SummaryLineItem.fromJson(Map<String, dynamic> json) {
final label = json['label']?.toString() ?? '';
final amount = json['amountCents'];
final amountCents = (amount is int)
? amount
: (amount is String ? int.tryParse(amount) ?? 0 : 0);
return SummaryLineItem(
label: label,
amountCents: amountCents,
sublabel: json['sublabel']?.toString(),
);
}