Message.fromJson constructor

Message.fromJson(
  1. Map<String, dynamic> json
)

Parse from a json

Implementation

factory Message.fromJson(Map<String, dynamic> json) => Message(
  id: json['id'],
  senderId: MessageSender.fromJson(json['sender_id']),
  chatId: json['chat_id'],
  sendingState: json['sending_state'] == null ? null : MessageSendingState.fromJson(json['sending_state']),
  schedulingState: json['scheduling_state'] == null ? null : MessageSchedulingState.fromJson(json['scheduling_state']),
  isOutgoing: json['is_outgoing'],
  isPinned: json['is_pinned'],
  canBeEdited: json['can_be_edited'],
  canBeForwarded: json['can_be_forwarded'],
  canBeSaved: json['can_be_saved'],
  canBeDeletedOnlyForSelf: json['can_be_deleted_only_for_self'],
  canBeDeletedForAllUsers: json['can_be_deleted_for_all_users'],
  canGetStatistics: json['can_get_statistics'],
  canGetMessageThread: json['can_get_message_thread'],
  canGetViewers: json['can_get_viewers'],
  canGetMediaTimestampLinks: json['can_get_media_timestamp_links'],
  hasTimestampedMedia: json['has_timestamped_media'],
  isChannelPost: json['is_channel_post'],
  containsUnreadMention: json['contains_unread_mention'],
  date: json['date'],
  editDate: json['edit_date'],
  forwardInfo: json['forward_info'] == null ? null : MessageForwardInfo.fromJson(json['forward_info']),
  interactionInfo: json['interaction_info'] == null ? null : MessageInteractionInfo.fromJson(json['interaction_info']),
  replyInChatId: json['reply_in_chat_id'],
  replyToMessageId: json['reply_to_message_id'],
  messageThreadId: json['message_thread_id'],
  ttl: json['ttl'] ?? 0,
  ttlExpiresIn: json['ttl_expires_in'],
  viaBotUserId: json['via_bot_user_id'],
  authorSignature: json['author_signature'],
  mediaAlbumId: int.parse(json['media_album_id']),
  restrictionReason: json['restriction_reason'],
  content: MessageContent.fromJson(json['content']),
  replyMarkup: json['reply_markup'] == null ? null : ReplyMarkup.fromJson(json['reply_markup']),
  extra: json['@extra'],
  clientId: json['@client_id'],
);