EMConversation.fromJson constructor

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

Implementation

factory EMConversation.fromJson(Map<String, dynamic> map) {
  Map<String, String>? ext = map["ext"]?.cast<String, String>();
  EMConversation ret = EMConversation._private(
    map["convId"],
    conversationTypeFromInt(map["type"]),
    ext,
    map["isThread"] ?? false,
    map["isPinned"] ?? false,
    map["pinnedTime"] ?? 0,
    map.getValue('marks', callback: (obj) {
      List<ConversationMarkType> marks = [];
      if (obj is List) {
        for (var mark in obj) {
          marks.add(ConversationMarkType.values[mark]);
        }
      }
      return marks;
    }),
  );

  return ret;
}