MmWsReply.fromJson constructor

MmWsReply.fromJson(
  1. Map<String, dynamic> map
)

Implementation

factory MmWsReply.fromJson(Map<String, dynamic> map) {
  var status = MmWsActionResponseStatus.fail;
  if (map['status'] == 'OK') status = MmWsActionResponseStatus.ok;
  var seqReply = map['seq_reply']; // if the error is for an invalid seq, then this will be null
  if (map['error'] != null) {
    var error = {...map['error'] as Map}.cast<String, String>();
    return MmWsReply(status, seqReply, error: error);
  }
  if (map['data'] != null) {
    return MmWsReply(status, seqReply, data: map['data']);
  }
  return MmWsReply(status, seqReply);
}