MitResponse.fromJson constructor

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

Cria uma instância de MitResponse a partir de um mapa JSON.

Implementation

factory MitResponse.fromJson(Map<String, dynamic> json) {
  final mensagens = <MensagemMit>[];
  if (json['mensagens'] != null) {
    for (final msg in json['mensagens']) {
      mensagens.add(MensagemMit.fromJson(msg));
    }
  }

  return MitResponse._internal(
    status: json['status']?.toString() ?? '',
    responseId: json['responseId']?.toString(),
    responseDateTime: json['responseDateTime']?.toString(),
    mensagens: mensagens,
  );
}