parse static method

SongFull parse(
  1. dynamic data
)

Implementation

static SongFull parse(dynamic data) {
  return SongFull(
    type: "SONG",
    videoId: traverseString(data, ["videoDetails", "videoId"]) ?? '',
    name: traverseString(data, ["videoDetails", "title"]) ?? '',
    artist: ArtistBasic(
      name: traverseString(data, ["author"]) ?? '',
      artistId: traverseString(data, ["videoDetails", "channelId"]),
    ),
    duration: int.parse(
        traverseString(data, ["videoDetails", "lengthSeconds"]) ?? '0'),
    thumbnails: traverseList(data, ["videoDetails", "thumbnails"])
        .map((item) => ThumbnailFull.fromMap(item))
        .toList(),
    formats: traverseList(data, ["streamingData", "formats"]),
    adaptiveFormats: traverseList(data, ["streamingData", "adaptiveFormats"]),
  );
}