ChatPhoto.fromJson constructor

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

Parse from a json

Implementation

factory ChatPhoto.fromJson(Map<String, dynamic> json) => ChatPhoto(
      id: int.parse(json['id']),
      addedDate: json['added_date'],
      minithumbnail: json['minithumbnail'] == null
          ? null
          : Minithumbnail.fromJson(json['minithumbnail']),
      sizes: List<PhotoSize>.from((json['sizes'] ?? [])
          .map((item) => PhotoSize.fromJson(item))
          .toList()),
      animation: json['animation'] == null
          ? null
          : AnimatedChatPhoto.fromJson(json['animation']),
      smallAnimation: json['small_animation'] == null
          ? null
          : AnimatedChatPhoto.fromJson(json['small_animation']),
      sticker: json['sticker'] == null
          ? null
          : ChatPhotoSticker.fromJson(json['sticker']),
    );