ChatConversation.fromJson constructor

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

Implementation

factory ChatConversation.fromJson(Map<String, dynamic> map) {
  Map<String, String>? ext = map["ext"]?.cast<String, String>();
  ChatConversation ret = ChatConversation._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;
}