Transaction.fromJson constructor

Transaction.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory Transaction.fromJson(Map<String, dynamic> json) {
  Transaction transaction = Transaction(
      uid: json['uid'],
      amount: json['amount'] != null ? (json['amount']).toDouble() : 0.0,
      currency: json['currency'],
      coins: json['coins'],
      reference: json['reference']);
  if (json['transactionTypeIdentifier'] != null) {
    transaction.transactionTypeIdentifier = json['transactionTypeIdentifier'];
  }
  if (json['remarks'] != null) {
    transaction.remarks = json['remarks'];
  }
  if (json['productName'] != null) {
    transaction.productName = json['productName'];
  }
  if (json['productId'] != null) {
    transaction.productId = json['productId'];
  }
  if (json['sku'] != null) {
    transaction.sku = json['sku'];
  }

  return transaction;
}