parse static method

PlaylistFull parse(
  1. dynamic data,
  2. String playlistId
)

Implementation

static PlaylistFull parse(dynamic data, String playlistId) {
  final artist = traverse(data, ["tabs", "straplineTextOne"]);

  return PlaylistFull(
    type: "PLAYLIST",
    playlistId: playlistId,
    name: traverseString(data, ["tabs", "title", "text"]) ?? '',
    artist: ArtistBasic(
      name: traverseString(artist, ["text"]) ?? '',
      artistId: traverseString(artist, ["browseId"]),
    ),
    videoCount: int.tryParse(
            traverseList(data, ["tabs", "secondSubtitle", "text"])
                .elementAt(2)
                .split(" ")
                .first
                .replaceAll(",", "")) ??
        0,
    thumbnails: traverseList(data, ["tabs", "thumbnails"])
        .map((item) => ThumbnailFull.fromMap(item))
        .toList(),
  );
}