VideoSnippet.fromJsonData constructor
VideoSnippet.fromJsonData(
- Map<String, dynamic> data
)
Implementation
factory VideoSnippet.fromJsonData(Map<String, dynamic> data) {
final thumbnails = Thumbnail.thumbnailsFromMap(data['thumbnails']);
final tags = List<String>.from(data['tags'] ?? []);
final publishedAt = DateTime.tryParse(data['publishedAt']);
final description = data['description'];
final title = data['title'];
final channelId = data['channelId'];
final channelTitle = data['channelTitle'];
final category =
Category.fromCategoryId(int.tryParse(data['categoryId'] ?? "") ?? -1);
return VideoSnippet(
thumbnails: thumbnails,
tags: tags,
publishedAt: publishedAt,
description: description,
title: title,
channelId: channelId,
channelTitle: channelTitle,
category: category,
);
}