getVideos method Null safety

Future<SearchList> getVideos(
  1. String searchQuery,
  2. {SearchFilter filter = const SearchFilter('')}
)

Enumerates videos returned by the specified search query (from the video search page). The videos are sent in batch of 20 videos. You SearchList.nextPage to get the next batch of videos.

Implementation

Future<SearchList> getVideos(String searchQuery,
    {SearchFilter filter = const SearchFilter('')}) async {
  final page = await SearchPage.get(_httpClient, searchQuery, filter: filter);

  return SearchList(
      page.initialData.searchContent
          .whereType<SearchVideo>()
          .map((e) => Video(
              e.id,
              e.title,
              e.author,
              ChannelId(e.channelId),
              e.uploadDate?.toDateTime(),
              null,
              e.description,
              e.duration.toDuration(),
              ThumbnailSet(e.id.value),
              null,
              Engagement(e.viewCount, null, null),
              e.isLive))
          .toList(),
      page,
      _httpClient);
}