InvoiceModel.fromMap constructor

InvoiceModel.fromMap(
  1. Map<String, dynamic> map
)

Implementation

factory InvoiceModel.fromMap(Map<String, dynamic> map) {
  return InvoiceModel(
    id: map['id'],
    dueDate: map['due_date'],
    currency: map['currency'],
    discountCents: map['discount_cents'],
    email: map['email'],
    itemsTotalCents: map['items_total_cents'],
    notificationUrl: map['notification_url'],
    returnUrl: map['return_url'],
    status: map['status'],
    taxCents: map['tax_cents'],
    updatedAt: map['updated_at'],
    totalCents: map['total_cents'],
    totalPaid: map['total_paid'],
    totalPaidCents: map['total_paid_cents'],
    paidAt: map['paid_at'],
    paidCents: map['paid_cents'],
    paid: map['paid'],
    secureId: map['secure_id'],
    secureUrl: map['secure_url'],
    customerId: map['customer_id'],
    userId: map['user_id'],
    total: map['total'],
    taxesPaid: map['taxes_paid'],
    interest: map['interest'],
    discount: map['discount'],
    createdAt: map['created_at'],
    refundable: map['refundable'],
    installments: map['installments'],
    bankSlip: map['bank_slip'] != null ? BankSlip.fromMap(map['bank_slip']) : null,
    items: List<Item>.from(map['items']?.map((x) => Item.fromMap(x))),
    variables: List<Variable>.from(map['variables']?.map((x) => Variable.fromMap(x))),
    customVariables: List<CustomVariables>.from(map['custom_variables']?.map((x) => CustomVariables.fromMap(x))),
    earlyPaymentDiscount: map['early_payment_discount'],
    earlyPaymentDiscounts: map['early_payment_discounts'] != null ? List<EarlyPaymentDiscounts>.from(map['early_payment_discounts']?.map((x) => EarlyPaymentDiscounts.fromMap(x))) : [],
    logs: List<Logs>.from(map['logs']?.map((x) => Logs.fromMap(x))),
  );
}