RenderJobView.fromJson constructor

RenderJobView.fromJson(
  1. Map<String, Object?> json
)

Parses a job view from json.

Implementation

factory RenderJobView.fromJson(Map<String, Object?> json) {
  final progress = json['progress'] as Map<String, Object?>?;
  final video = json['video'] as Map<String, Object?>?;
  final poster = json['poster'] as Map<String, Object?>?;
  return RenderJobView(
    id: json['id']! as String,
    status: json['status']! as String,
    completed: progress?['completed'] as int?,
    total: progress?['total'] as int?,
    error: json['error'] as String?,
    video: video == null ? null : FileLink.fromJson(video),
    poster: poster == null ? null : FileLink.fromJson(poster),
    code: json['code'] as String?,
    spec: json['spec'] as Map<String, Object?>?,
    createdAt: _time(json['createdAt'] as String?),
    expiresAt: _time(json['expiresAt'] as String?),
  );
}