ChannelData.fromJson constructor

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

Implementation

factory ChannelData.fromJson(Map<String, dynamic> json) {
  return ChannelData(
    id: json['id'],
    url: json['url'],
    displayName: json['display_name'],
    parent: json['parent'],
    slug: json['slug'],
    type: ChannelType.fromString(json['type']),
    contentType: ChannelContentType.fromString(json['content_type']),
    user: UserData.fromJson(json['user']),
    bannerImage: json['banner_image'],
    shortDisplayName: json['short_display_name'],
    description: json['description'],
    metadataDescription: json['metadata_description'],
    hasChildren: json['has_children'],
    isVisible: json['is_visible'],
    isPrivate: json['is_private'],
    isLive: json['is_live'],
    featuredGif: json['featured_gif'] == null
        ? null
        : GifData.fromJson(json['featured_gif']),
    screensaverGif: json['screensaver_gif'],
    tags: (json['tags'] as List)
        .map((tag) => ChannelTagData.fromJson(tag))
        .toList(),
    liveSinceDatetime: json['live_since_datetime'] == null
        ? null
        : DateTime.parse(json['live_since_datetime']),
    liveUntilDatetime: json['live_until_datetime'] == null
        ? null
        : DateTime.parse(json['live_until_datetime']),
    ancestors: (json['ancestors'] as List)
        .map((ancestor) => ChannelData.fromJson(ancestor))
        .toList(),
    syncableTags: json['syncable_tags'] == null
        ? []
        : (json['syncable_tags'] as List)
            .map((tag) => ChannelTagData.fromJson(tag))
            .toList(),
  );
}