decode static method
Implementation
static PrinterRequest decode(Object message) {
final Map<Object?, Object?> receiptMap = message as Map<Object?, Object?>;
return PrinterRequest(
transactionID: receiptMap['transactionID'] as String?,
id: receiptMap['id'] as String?,
customerId: receiptMap['customerId'] as String?,
customerName: receiptMap['customerName'] as String?,
customerEmail: receiptMap['customerEmail'] as String?,
customerMobile: receiptMap['customerMobile'] as String?,
displayCustomer: receiptMap['displayCustomer'] as bool?,
displaySeller: receiptMap['displaySeller'] as bool?,
ticketId: receiptMap['ticketId'] as String?,
ticketName: receiptMap['ticketName'] as String?,
sellerId: receiptMap['sellerId'] as String?,
sellerName: receiptMap['sellerName'] as String?,
currencyCode: receiptMap['currencyCode'] as String?,
countryCode: receiptMap['countryCode'] as String?,
deviceId: receiptMap['deviceId'] as String?,
taxInclusive: receiptMap['taxInclusive'] as bool?,
totalValue: receiptMap['totalValue'] as double?,
totalCost: receiptMap['totalCost'] as double?,
totalMarkup: receiptMap['totalMarkup'] as double?,
totalDiscount: receiptMap['totalDiscount'] as double?,
totalTax: receiptMap['totalTax'] as double?,
amountTendered: receiptMap['amountTendered'] as double?,
amountChange: receiptMap['amountChange'] as double?,
transactionDate: receiptMap['transactionDate'] as String?,
transactionTime: receiptMap['transactionTime'] as String?,
businessName: receiptMap['businessName'] as String?,
address: receiptMap['address'] != null
? PrintAddress.decode(receiptMap['address']!)
: null,
vAT: receiptMap['vAT'] as String?,
tell: receiptMap['tell'] as String?,
checkoutMessage: receiptMap['checkoutMessage'] as String?,
taxCode: receiptMap['taxCode'] as String?,
taxValue: receiptMap['taxValue'] as double?,
items: (receiptMap['items'] as List<Object?>?)
?.map((item) => item == null ? null : Inventory.decode(item))
.toList() ??
<Inventory>[],
header: receiptMap['header'] as String?,
footer: receiptMap['footer'] as String?,
instagram: receiptMap['instagram'] as String?,
website: receiptMap['website'] as String?,
whatsapp: receiptMap['whatsapp'] as String?,
image: receiptMap['image'] as Uint8List?,
cashbackAmount: receiptMap['cashbackAmount'] as double?,
tipAmount: receiptMap['tipAmount'] as double?,
totalDue: receiptMap['totalDue'] as double?,
withdrawalAmount: receiptMap['withdrawalAmount'] as double?,
paymentType: receiptMap['paymentType'] as String?,
);
}