fromMap static method

MessageThreadInfo? fromMap(
  1. Map<String, dynamic>? _map
)
override

Construct from Map.

Implementation

static MessageThreadInfo? fromMap(Map<String, dynamic>? _map) {
  if (_map == null) return null;
  var _ = _map["@type"];
  if (_ != CONSTRUCTOR) return null;
  var extra = _map['@extra'];
  var clientId = _map['@clientId'];
  var chat_id = _map['chat_id']! as int;
  var message_thread_id = _map['message_thread_id']! as int;
  var reply_info = MessageReplyInfo.fromMap(_map['reply_info']);
  var unread_message_count = _map['unread_message_count']! as int;
  var messages = List<Message>.from(
    (_map["messages"] ?? []).map(
      (e) => Message.fromMap(e),
    ),
  );
  var draft_message = DraftMessage.fromMap(_map['draft_message']);
  return MessageThreadInfo(
    extra: extra,
    clientId: clientId,
    chat_id: chat_id,
    message_thread_id: message_thread_id,
    reply_info: reply_info,
    unread_message_count: unread_message_count,
    messages: messages,
    draft_message: draft_message,
  );
}