fromMap static method

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

Construct from Map.

Implementation

static MessageContent? fromMap(Map<String, dynamic>? _map) {
  if (_map == null) return null;
  var _ = _map["@type"];
  switch (_) {
    case 'messageVideoNote':
      return MessageVideoNote.fromMap(_map);
    case 'messageCustomServiceAction':
      return MessageCustomServiceAction.fromMap(_map);
    case 'messageScreenshotTaken':
      return MessageScreenshotTaken.fromMap(_map);
    case 'messageUserShared':
      return MessageUserShared.fromMap(_map);
    case 'messageContactRegistered':
      return MessageContactRegistered.fromMap(_map);
    case 'messageGame':
      return MessageGame.fromMap(_map);
    case 'messageGameScore':
      return MessageGameScore.fromMap(_map);
    case 'messageVideo':
      return MessageVideo.fromMap(_map);
    case 'messageForumTopicCreated':
      return MessageForumTopicCreated.fromMap(_map);
    case 'messageWebAppDataSent':
      return MessageWebAppDataSent.fromMap(_map);
    case 'messageForumTopicEdited':
      return MessageForumTopicEdited.fromMap(_map);
    case 'messageUnsupported':
      return MessageUnsupported.fromMap(_map);
    case 'messageGiftedPremium':
      return MessageGiftedPremium.fromMap(_map);
    case 'messageVideoChatScheduled':
      return MessageVideoChatScheduled.fromMap(_map);
    case 'messageDice':
      return MessageDice.fromMap(_map);
    case 'messageDocument':
      return MessageDocument.fromMap(_map);
    case 'messageChatChangeTitle':
      return MessageChatChangeTitle.fromMap(_map);
    case 'messageWebAppDataReceived':
      return MessageWebAppDataReceived.fromMap(_map);
    case 'messageChatDeletePhoto':
      return MessageChatDeletePhoto.fromMap(_map);
    case 'messageSuggestProfilePhoto':
      return MessageSuggestProfilePhoto.fromMap(_map);
    case 'messageChatJoinByLink':
      return MessageChatJoinByLink.fromMap(_map);
    case 'messageExpiredPhoto':
      return MessageExpiredPhoto.fromMap(_map);
    case 'messagePassportDataSent':
      return MessagePassportDataSent.fromMap(_map);
    case 'messageProximityAlertTriggered':
      return MessageProximityAlertTriggered.fromMap(_map);
    case 'messageForumTopicIsHiddenToggled':
      return MessageForumTopicIsHiddenToggled.fromMap(_map);
    case 'messageLocation':
      return MessageLocation.fromMap(_map);
    case 'messageVoiceNote':
      return MessageVoiceNote.fromMap(_map);
    case 'messageVideoChatEnded':
      return MessageVideoChatEnded.fromMap(_map);
    case 'messageBasicGroupChatCreate':
      return MessageBasicGroupChatCreate.fromMap(_map);
    case 'messageVenue':
      return MessageVenue.fromMap(_map);
    case 'messageStory':
      return MessageStory.fromMap(_map);
    case 'messagePinMessage':
      return MessagePinMessage.fromMap(_map);
    case 'messageForumTopicIsClosedToggled':
      return MessageForumTopicIsClosedToggled.fromMap(_map);
    case 'messageContact':
      return MessageContact.fromMap(_map);
    case 'messageVideoChatStarted':
      return MessageVideoChatStarted.fromMap(_map);
    case 'messageSupergroupChatCreate':
      return MessageSupergroupChatCreate.fromMap(_map);
    case 'messageExpiredVideo':
      return MessageExpiredVideo.fromMap(_map);
    case 'messageInvoice':
      return MessageInvoice.fromMap(_map);
    case 'messageChatJoinByRequest':
      return MessageChatJoinByRequest.fromMap(_map);
    case 'messageChatSetMessageAutoDeleteTime':
      return MessageChatSetMessageAutoDeleteTime.fromMap(_map);
    case 'messagePaymentSuccessfulBot':
      return MessagePaymentSuccessfulBot.fromMap(_map);
    case 'messageChatSetBackground':
      return MessageChatSetBackground.fromMap(_map);
    case 'messageChatUpgradeFrom':
      return MessageChatUpgradeFrom.fromMap(_map);
    case 'messageChatChangePhoto':
      return MessageChatChangePhoto.fromMap(_map);
    case 'messageChatAddMembers':
      return MessageChatAddMembers.fromMap(_map);
    case 'messageSticker':
      return MessageSticker.fromMap(_map);
    case 'messageChatSetTheme':
      return MessageChatSetTheme.fromMap(_map);
    case 'messageChatShared':
      return MessageChatShared.fromMap(_map);
    case 'messagePassportDataReceived':
      return MessagePassportDataReceived.fromMap(_map);
    case 'messageAudio':
      return MessageAudio.fromMap(_map);
    case 'messagePaymentSuccessful':
      return MessagePaymentSuccessful.fromMap(_map);
    case 'messageInviteVideoChatParticipants':
      return MessageInviteVideoChatParticipants.fromMap(_map);
    case 'messagePhoto':
      return MessagePhoto.fromMap(_map);
    case 'messageText':
      return MessageText.fromMap(_map);
    case 'messageAnimatedEmoji':
      return MessageAnimatedEmoji.fromMap(_map);
    case 'messageAnimation':
      return MessageAnimation.fromMap(_map);
    case 'messageCall':
      return MessageCall.fromMap(_map);
    case 'messageChatDeleteMember':
      return MessageChatDeleteMember.fromMap(_map);
    case 'messageChatUpgradeTo':
      return MessageChatUpgradeTo.fromMap(_map);
    case 'messageBotWriteAccessAllowed':
      return MessageBotWriteAccessAllowed.fromMap(_map);
    case 'messageWebsiteConnected':
      return MessageWebsiteConnected.fromMap(_map);
    case 'messagePoll':
      return MessagePoll.fromMap(_map);
    case null:
    default:
      return null;
  }
}