Pix.fromMap constructor

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

A factory method for creating a PIX object from a MAP object.

this method takes a Map<String, dynamic> object and returns a new instance of PIX class.

The following keys must be present in the input MAP object:

  • 'valor': the value of the payment.
  • 'horario': the date and time when the payment was made.
  • 'pagador': a Map<String, dynamic> object representing the payer.
  • 'infoPagador': additional information about the payer.
  • 'devolucoes': List of values ​​returned from the transaction, and starting with an empty list

The following key is optional:

  • 'endToEndId': a unique identifier for the payment.
  • 'txid': a transaction ID for the payment.

Implementation

factory Pix.fromMap(Map<String, dynamic> map) {
  return Pix(
      endToEndId: map['endToEndId'],
      txid: map['txid'],
      valor: map['valor'],
      horario: map['horario'],
      nomePagador: map['nomePagador'],
      pagador: Pagador.fromMap(map['pagador'] as Map<String, dynamic>),
      infoPagador: map['infoPagador'],
      devolucoes: List.from(
        (map['devolucoes'] as List),
      ));
}