LinkPreview.fromJson constructor

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

Parses a LinkPreview from TDLib JSON.

Implementation

factory LinkPreview.fromJson(Map<String, dynamic> json) => LinkPreview(
  url: _readString(json['url']),
  displayUrl: _readString(json['display_url']),
  siteName: _readString(json['site_name']),
  title: _readString(json['title']),
  description: _readObject(json['description'], FormattedText.fromJson),
  author: _readString(json['author']),
  type: _readObject(json['type'], LinkPreviewType.fromJson),
  hasLargeMedia: _readBool(json['has_large_media']),
  showLargeMedia: _readBool(json['show_large_media']),
  showMediaAboveDescription: _readBool(json['show_media_above_description']),
  skipConfirmation: _readBool(json['skip_confirmation']),
  showAboveText: _readBool(json['show_above_text']),
  instantViewVersion: _readInt(json['instant_view_version']),
  extra: json['@extra'],
  clientId: _readClientId(json['@client_id']),
);