fromJson static method

ContractBase fromJson(
  1. String type,
  2. Map<String, dynamic> data
)

Implementation

static ContractBase fromJson(String type, Map<String, dynamic> data) {
  switch (type) {
    case 'newMail':
      return NewMail.fromJson(data);
    case 'mailUpdate':
      return MailUpdate.fromJson(data);
    case 'mailDelete':
      return MailDelete.fromJson(data);
    case 'mailHeaderUpdate':
      return MailHeaderUpdate.fromJson(data);
    case 'newNotify':
      return NewNotify.fromJson(data);
    case 'notifyUpdate':
      return NotifyUpdate.fromJson(data);
    case 'commentUpdate':
      return CommentUpdate.fromJson(data);
    case 'commentDelete':
      return CommentDelete.fromJson(data);
    case 'newComment':
      return NewComment.fromJson(data);
    case 'commentTyping':
      return CommentTyping.fromJson(data);
    case 'newChat':
      return NewChat.fromJson(data);
    case 'chatSeen':
      return ChatSeen.fromJson(data);
    case 'chatTyping':
      return ChatTyping.fromJson(data);
    case 'callback':
      return Callback.fromJson(data);
    default:
      throw ('unexpected hub contract ${data['type']}');
  }
}