fromMap static method

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

Construct from Map.

Implementation

static InputMessagePhoto? 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 photo = InputFile.fromMap(_map['photo'])!;
  var thumbnail = InputThumbnail.fromMap(_map['thumbnail']);
  var added_sticker_file_ids = List<int>.from(
    (_map["added_sticker_file_ids"] ?? []).map(
      (e) => e as int,
    ),
  );
  var width = _map['width']! as int;
  var height = _map['height']! as int;
  var caption = FormattedText.fromMap(_map['caption']);
  var self_destruct_type =
      MessageSelfDestructType.fromMap(_map['self_destruct_type']);
  var has_spoiler = _map['has_spoiler']! as bool;
  return InputMessagePhoto(
    extra: extra,
    clientId: clientId,
    photo: photo,
    thumbnail: thumbnail,
    added_sticker_file_ids: added_sticker_file_ids,
    width: width,
    height: height,
    caption: caption,
    self_destruct_type: self_destruct_type,
    has_spoiler: has_spoiler,
  );
}