fromJson method

  1. @override
URecordViewRecordEmbed fromJson(
  1. Map<String, dynamic> json
)

Implementation

@override
URecordViewRecordEmbed fromJson(Map<String, dynamic> json) {
  try {
    if (isImagesView(json)) {
      return URecordViewRecordEmbed.imagesView(
        data: const ImagesViewConverter().fromJson(json),
      );
    }
    if (isVideoView(json)) {
      return URecordViewRecordEmbed.videoView(
        data: const VideoViewConverter().fromJson(json),
      );
    }
    if (isExternalView(json)) {
      return URecordViewRecordEmbed.externalView(
        data: const ExternalViewConverter().fromJson(json),
      );
    }
    if (isRecordView(json)) {
      return URecordViewRecordEmbed.recordView(
        data: const RecordViewConverter().fromJson(json),
      );
    }
    if (isRecordWithMediaView(json)) {
      return URecordViewRecordEmbed.recordWithMediaView(
        data: const RecordWithMediaViewConverter().fromJson(json),
      );
    }

    return URecordViewRecordEmbed.unknown(data: json);
  } catch (_) {
    return URecordViewRecordEmbed.unknown(data: json);
  }
}