fromJson method
Implementation
@override
UFeedPostEmbed fromJson(Map<String, dynamic> json) {
try {
if (EmbedImages.validate(json)) {
return UFeedPostEmbed.embedImages(
data: const EmbedImagesConverter().fromJson(json),
);
}
if (EmbedVideo.validate(json)) {
return UFeedPostEmbed.embedVideo(
data: const EmbedVideoConverter().fromJson(json),
);
}
if (EmbedExternal.validate(json)) {
return UFeedPostEmbed.embedExternal(
data: const EmbedExternalConverter().fromJson(json),
);
}
if (EmbedRecord.validate(json)) {
return UFeedPostEmbed.embedRecord(
data: const EmbedRecordConverter().fromJson(json),
);
}
if (EmbedRecordWithMedia.validate(json)) {
return UFeedPostEmbed.embedRecordWithMedia(
data: const EmbedRecordWithMediaConverter().fromJson(json),
);
}
return UFeedPostEmbed.unknown(data: json);
} catch (_) {
return UFeedPostEmbed.unknown(data: json);
}
}