fromMap static method

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

Construct from Map.

Implementation

static ChatPhoto? 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 id = _map['id']! as int64;
  var added_date = _map['added_date']! as int;
  var minithumbnail = Minithumbnail.fromMap(_map['minithumbnail']);
  var sizes = List<PhotoSize>.from(
    (_map["sizes"] ?? []).map(
      (e) => PhotoSize.fromMap(e),
    ),
  );
  var animation = AnimatedChatPhoto.fromMap(_map['animation']);
  var small_animation = AnimatedChatPhoto.fromMap(_map['small_animation']);
  var sticker = ChatPhotoSticker.fromMap(_map['sticker']);
  return ChatPhoto(
    extra: extra,
    clientId: clientId,
    id: id,
    added_date: added_date,
    minithumbnail: minithumbnail,
    sizes: sizes,
    animation: animation,
    small_animation: small_animation,
    sticker: sticker,
  );
}