V2TimMessageSearchResultItem.fromJson constructor
V2TimMessageSearchResultItem.fromJson(- Map json
)
Implementation
V2TimMessageSearchResultItem.fromJson(Map json) {
json = Utils.formatJson(json);
conversationID = json['msg_search_result_item_conv_id'];
messageCount = json['msg_search_result_item_total_message_count'];
if (json['msg_search_result_item_message_array'] != null) {
messageList = List.empty(growable: true);
json['msg_search_result_item_message_array'].forEach((v) {
messageList?.add(V2TimMessage.fromJson(v));
});
} else {
messageList = [];
}
int convType = json['msg_search_result_item_conv_type'];
String prefix = "group_";
if (convType != null && convType == TIMConvType.kTIMConv_C2C.index) {
prefix = "c2c_";
}
if (conversationID != null) {
conversationID = prefix + conversationID!;
}
}