fromJson static method

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

Implementation

static InputPhoto? fromJson(Map<String, dynamic>? json) {
  if (json == null) {
    return null;
  }

  return InputPhoto(
    photo: InputFile.fromJson(json['photo'] as Map<String, dynamic>?)!,
    thumbnail:
        InputThumbnail.fromJson(json['thumbnail'] as Map<String, dynamic>?),
    video: InputFile.fromJson(json['video'] as Map<String, dynamic>?),
    addedStickerFileIds: List<int>.from(
        ((json['added_sticker_file_ids'] as List<dynamic>?) ?? <dynamic>[])
            .map((item) =>
                (item is int ? item : int.tryParse(item.toString()) ?? 0))
            .toList()),
    width: (json['width'] as int?) ?? 0,
    height: (json['height'] as int?) ?? 0,
  );
}