Invoice.fromObject constructor

Invoice.fromObject(
  1. Map map
)

Implementation

factory Invoice.fromObject(Map map) {
  return Invoice(
    reference: map['reference'],
    resolution: map['resolution'] != null ? Resolution.fromObject(map['resolution']) : null,
    number: map['number']?.toString(),
    date: map['date']?.toString(),
    hour: map['hour'],
    establishment: map['establishment'] != null ? Establishment.fromObject(map['establishment']) : null,
    customer: map['customer'] != null ? Person.fromObject(map['customer']) : null,
    paymentMeans: map['paymentMeans'],
    paymentPrepaid: map['paymentPrepaid'],
    retentions: map['retentions'],
    charges: (map['charges'] as List?)?.map((e) => Charge.fromObject(e)).toList(),
    items: (map['items'] as List?)?.map((e) => Detail.fromObject(e)).toList() ?? [],

    taxes: (map['taxes'] as List?)?.map((e) => Tax.fromObject(e)).toList(),
    totals: map['totals'] != null ? Totals.fromObject(map['totals'] as Map) : null,
    sellerName: map['sellerName'],
    website: map['website'],
    sendmail: map['sendmail'],
    sendmailtome: map['sendmailtome'],
    notes: map['notes'],
    noteHead: map['noteHead'],
    noteFoot: map['noteFoot'],
    delivery: map['delivery'],
    paymentsPse: map['paymentsPse'],
    id: map['id'],
    dateId: map['dateId'],

    state: map['state'],
    stateOrder: map['stateOrder'],
    cufe: map['cufe'],
    payments: map['payments'],
    response: map['response'] ?? {},
  );
}