V2TimValueCallback<T>.fromJson constructor
V2TimValueCallback<T>.fromJson(
- 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 == _getT<Map<String, int>>()) {
fromJsonData = Map<String, int>.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 == V2TimConversationOperationResult) {
fromJsonData =
V2TimConversationOperationResult.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<V2TimMessageExtensionResult>>()) {
fromJsonData = (json['data'] as List).map((e) {
return V2TimMessageExtensionResult.fromJson(e);
}).toList() as T;
} else if (T == _getT<List<V2TimMessageExtension>>()) {
fromJsonData = (json['data'] as List).map((e) {
return V2TimMessageExtension.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 == V2TimMessageListResult) {
fromJsonData = V2TimMessageListResult.fromJson(json['data']);
} else if (T == V2TimMessageOnlineUrl) {
fromJsonData = V2TimMessageOnlineUrl.fromJson(json['data']);
} else if (T == V2TimMessageChangeInfo) {
fromJsonData = V2TimMessageChangeInfo.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 if (T == _getT<List<V2TimTopicInfoResult>>()) {
fromJsonData = (json['data'] as List).map((e) {
return V2TimTopicInfoResult.fromJson(e);
}).toList() as T;
} else if (T == _getT<List<V2TimTopicOperationResult>>()) {
fromJsonData = (json['data'] as List).map((e) {
return V2TimTopicOperationResult.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<V2TimUserStatus>>()) {
fromJsonData = (json['data'] as List).map((e) {
return V2TimUserStatus.fromJson(e);
}).toList() as T;
} else if (T == _getT<List<V2TimConversationOperationResult>>()) {
fromJsonData = (json['data'] as List).map((e) {
return V2TimConversationOperationResult.fromJson(e);
}).toList() as T;
} else if (T == _getT<List<String>>()) {
fromJsonData =
List.from(json["data"]).map((e) => e.toString()).toList();
} else {
fromJsonData = json['data'] as T;
}
}
code = json['code'];
desc = json['desc'] ?? '';
data = fromJsonData;
}