fromMap static method

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

Construct from Map.

Implementation

static WebPage? 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 url = _map['url']! as String;
  var display_url = _map['display_url']! as String;
  var type = _map['type']! as String;
  var site_name = _map['site_name']! as String;
  var title = _map['title']! as String;
  var description = FormattedText.fromMap(_map['description'])!;
  var photo = Photo.fromMap(_map['photo']);
  var embed_url = _map['embed_url']! as String;
  var embed_type = _map['embed_type']! as String;
  var embed_width = _map['embed_width']! as int;
  var embed_height = _map['embed_height']! as int;
  var duration = _map['duration']! as int;
  var author = _map['author']! as String;
  var animation = Animation.fromMap(_map['animation']);
  var audio = Audio.fromMap(_map['audio']);
  var document = Document.fromMap(_map['document']);
  var sticker = Sticker.fromMap(_map['sticker']);
  var video = Video.fromMap(_map['video']);
  var video_note = VideoNote.fromMap(_map['video_note']);
  var voice_note = VoiceNote.fromMap(_map['voice_note']);
  var story_sender_chat_id = _map['story_sender_chat_id']! as int;
  var story_id = _map['story_id']! as int;
  var instant_view_version = _map['instant_view_version']! as int;
  return WebPage(
    extra: extra,
    clientId: clientId,
    url: url,
    display_url: display_url,
    type: type,
    site_name: site_name,
    title: title,
    description: description,
    photo: photo,
    embed_url: embed_url,
    embed_type: embed_type,
    embed_width: embed_width,
    embed_height: embed_height,
    duration: duration,
    author: author,
    animation: animation,
    audio: audio,
    document: document,
    sticker: sticker,
    video: video,
    video_note: video_note,
    voice_note: voice_note,
    story_sender_chat_id: story_sender_chat_id,
    story_id: story_id,
    instant_view_version: instant_view_version,
  );
}