getStorylyComponent function

StoryComponent? getStorylyComponent(
  1. Map<String, dynamic>? json
)

Implementation

StoryComponent? getStorylyComponent(Map<String, dynamic>? json) {
  if (json == null) return null;

  switch (json['type']) {
    case 'quiz':
      return StoryQuizComponent.fromJson(json);
    case 'poll':
      return StoryPollComponent.fromJson(json);
    case 'emoji':
      return StoryEmojiComponent.fromJson(json);
    case 'rating':
      return StoryRatingComponent.fromJson(json);
    case 'promocode':
      return StoryPromocodeComponent.fromJson(json);
    case 'comment':
      return StoryCommentComponent.fromJson(json);
    default:
      return StoryComponent.fromJson(json);
  }
}