parse static method

VideoFull parse(
  1. dynamic data
)

Implementation

static VideoFull parse(dynamic data) {
  return VideoFull(
    type: "VIDEO",
    videoId: traverseString(data, ["videoDetails", "videoId"]) ?? '',
    name: traverseString(data, ["videoDetails", "title"]) ?? '',
    artist: ArtistBasic(
      artistId: traverseString(data, ["videoDetails", "channelId"]),
      name: traverseString(data, ["author"]) ?? '',
    ),
    duration: int.parse(
        traverseString(data, ["videoDetails", "lengthSeconds"]) ?? '0'),
    thumbnails: traverseList(data, ["videoDetails", "thumbnails"])
        .map((item) => ThumbnailFull.fromMap(item))
        .toList(),
    unlisted: traverse(data, ["unlisted"]),
    familySafe: traverse(data, ["familySafe"]),
    paid: traverse(data, ["paid"]),
    tags: traverseList(data, ["tags"]).whereType<String>().toList(),
  );
}