Media.fromJson constructor Null safety

Media.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory Media.fromJson(Map<String, dynamic> json) {
  return Media(
    type: json['type'],
    storyComponentList: castOrNull(json['storyComponentList']
        ?.map<StoryComponent?>((e) => getStorylyComponent(e))
        .toList()),
    actionUrlList: castOrNull(
        json['actionUrlList']?.map<String>((e) => e as String).toList()),
    actionUrl: json['actionUrl'],
    previewUrl: json['previewUrl'],
  );
}