fromJson static method
Creates a new PaidMedia object. This method decides which PaidMedia subclass to use based on the type field.
Implementation
static PaidMedia fromJson(Map<String, dynamic> json) {
return switch (PaidMediaType.fromJson(json['type'])) {
PaidMediaType.preview => PaidMediaPreview.fromJson(json),
PaidMediaType.photo => PaidMediaPhoto.fromJson(json),
PaidMediaType.video => PaidMediaVideo.fromJson(json),
};
}