PreviewData.fromJson constructor
Implementation
factory PreviewData.fromJson(Map<String, dynamic> json) {
final image = json['image'];
final video = json['video'];
return PreviewData(
type: Type.values.firstWhere((it) => json['type'] as String == it.name),
heroTag: json['heroTag'] as String,
image: image == null ? null : ImageData.fromJson(image),
video: video == null ? null : VideoData.fromJson(video),
);
}