PlayList.fromMap constructor

PlayList.fromMap(
  1. Map<String, dynamic>? map
)

Implementation

factory PlayList.fromMap(Map<String, dynamic>? map) {
  List<Thumbnail> thumbnails = [];
  map?['playlistRenderer']['thumbnails']
      .forEach((thumbnail) {
    thumbnails.add(Thumbnail(url: thumbnail['thumbnails'][0]['url'], width: thumbnail['thumbnails'][0]['width'], height: thumbnail['thumbnails'][0]['height']));
  });
  return PlayList(
      playListId: map?['playlistRenderer']['playlistId'],
      thumbnails: thumbnails,
      title: map?['playlistRenderer']['title']['simpleText'],
      videoCount: map?['playlistRenderer']['videoCount'],
      channelName: map?['playlistRenderer']['shortBylineText']['runs'][0]
          ['text']);
}