V2TimValueCallback<T>.fromJson constructor

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

Implementation

V2TimValueCallback.fromJson(Map<String, dynamic> json) {
  late dynamic fromJsonData;
  if (json['data'] == null) {
    fromJsonData = data;
  } else {
    if (T == V2TimMessage) {
      fromJsonData = V2TimMessage.fromJson(json['data']) as T;
    } else if (T == V2TimUserFullInfo) {
      fromJsonData = V2TimUserFullInfo.fromJson(json['data']) as T;
    } else if (T == _getT<List<V2TimUserFullInfo>>()) {
      fromJsonData = (json['data'] as List).map((e) {
        return V2TimUserFullInfo.fromJson(e);
      }).toList() as T;
    } else if (T == _getT<List<V2TimGroupInfo>>()) {
      fromJsonData = (json['data'] as List).map((e) {
        return V2TimGroupInfo.fromJson(e);
      }).toList() as T;
    } else if (T == _getT<List<V2TimGroupInfoResult>>()) {
      fromJsonData = (json['data'] as List).map((e) {
        return V2TimGroupInfoResult.fromJson(e);
      }).toList() as T;
    } else if (T == _getT<Map<String, String>>()) {
      fromJsonData = Map<String, String>.from(json['data']) as T;
    } else if (T == V2TimGroupMemberInfoResult) {
      fromJsonData = V2TimGroupMemberInfoResult.fromJson(json['data']) as T;
    } else if (T == _getT<List<V2TimGroupMemberFullInfo>>()) {
      fromJsonData = (json['data'] as List).map((e) {
        return V2TimGroupMemberFullInfo.fromJson(e);
      }).toList() as T;
    } else if (T == _getT<List<V2TimGroupMemberOperationResult>>()) {
      fromJsonData = (json['data'] as List).map((e) {
        return V2TimGroupMemberOperationResult.fromJson(e);
      }).toList() as T;
    } else if (T == V2TimGroupApplicationResult) {
      fromJsonData = V2TimGroupApplicationResult.fromJson(json['data']) as T;
    } else if (T == V2TimConversationResult) {
      fromJsonData = V2TimConversationResult.fromJson(json['data']) as T;
    } else if (T == V2TimConversation) {
      fromJsonData = V2TimConversation.fromJson(json['data']) as T;
    } else if (T == _getT<List<V2TimFriendInfo>>()) {
      fromJsonData = (json['data'] as List).map((e) {
        return V2TimFriendInfo.fromJson(e);
      }).toList() as T;
    } else if (T == _getT<List<V2TimFriendInfoResult>>()) {
      fromJsonData = (json['data'] as List).map((e) {
        return V2TimFriendInfoResult.fromJson(e);
      }).toList() as T;
    } else if (T == V2TimFriendOperationResult) {
      fromJsonData = V2TimFriendOperationResult.fromJson(json['data']) as T;
    } else if (T == _getT<List<V2TimFriendOperationResult>>()) {
      fromJsonData = (json['data'] as List).map((e) {
        return V2TimFriendOperationResult.fromJson(e);
      }).toList() as T;
    } else if (T == V2TimFriendCheckResult) {
      fromJsonData = V2TimFriendCheckResult.fromJson(json['data']) as T;
    } else if (T == _getT<List<V2TimFriendCheckResult>>()) {
      fromJsonData = (json['data'] as List).map((e) {
        return V2TimFriendCheckResult.fromJson(e);
      }).toList() as T;
    } else if (T == V2TimFriendApplicationResult) {
      fromJsonData = V2TimFriendApplicationResult.fromJson(json['data']) as T;
    } else if (T == _getT<List<V2TimFriendGroup>>()) {
      fromJsonData = (json['data'] as List).map((e) {
        return V2TimFriendGroup.fromJson(e);
      }).toList() as T;
    } else if (T == _getT<List<V2TimMessage>>()) {
      fromJsonData = (json['data'] as List).map((e) {
        return V2TimMessage.fromJson(e);
      }).toList() as T;
    } else if (T == _getT<List<V2TimConversation>>()) {
      fromJsonData = (json['data'] as List).map((e) {
        return V2TimConversation.fromJson(e);
      }).toList() as T;
    } else if (T == _getT<List<V2TimReceiveMessageOptInfo>>()) {
      fromJsonData = (json['data'] as List).map((e) {
        return V2TimReceiveMessageOptInfo.fromJson(e);
      }).toList() as T;
    } else if (T == V2TimMessageSearchResult) {
      fromJsonData = V2TimMessageSearchResult.fromJson(json['data']) as T;
    } else if (T == V2GroupMemberInfoSearchResult) {
      fromJsonData = V2GroupMemberInfoSearchResult.fromJson(
          json['data']); // V2TimSignalingInfo
    } else if (T == V2TimSignalingInfo) {
      fromJsonData = V2TimSignalingInfo.fromJson(json['data']);
    } else if (T == V2TimMsgCreateInfoResult) {
      fromJsonData = V2TimMsgCreateInfoResult.fromJson(json['data']);
    } else if (T == V2TimGroupMessageReadMemberList) {
      fromJsonData = V2TimGroupMessageReadMemberList.fromJson(json['data']);
    } else if (T == _getT<List<V2TimMessageReceipt>>()) {
      fromJsonData = (json['data'] as List).map((e) {
        return V2TimMessageReceipt.fromJson(e);
      }).toList() as T;
    } else {
      fromJsonData = json['data'];
    }
  }

  code = json['code'];
  desc = json['desc'] ?? '';
  data = fromJsonData;
}