VideoWithComments.fromMap constructor Null safety

VideoWithComments.fromMap(
  1. Map<String, dynamic> map
)

Implementation

factory VideoWithComments.fromMap(Map<String, dynamic> map) {
  return VideoWithComments(
    id: map['id'],
    title: map['title'],
    type: EnumToString.fromString(VideoType.values, map['type']) ??
        VideoType.clip,
    topicId: map['topic_id'],
    publishedAt: map['published_at'],
    availableAt: map['available_at'],
    duration: map['duration'],
    status: EnumUtil.convertStringToVideoStatus(map['status']) ??
        VideoStatus.missing,
    startScheduled: map['start_scheduled'],
    startActual: map['start_actual'],
    endActual: map['end_actual'],
    liveViewers: map['live_viewers'],
    description: map['description'],
    songcount: map['songcount'],
    channelId: map['channel_id'],
    channel: ChannelMin.fromMap(map['channel']),
    language: map['lang'],
    comments: List<Comment>.from(
      map['comments']?.map((x) => Comment.fromMap(x)) ?? [],
    ),
  );
}